九九乘法表

#include <iostream>

using namespace std;

int main()
{
    int j;
    int k;
    cout<<"打印九九乘法表"<<endl;
    for(j=1;j<=9;j++)
        for(k=1;k<=9;k++)
        if(k==9)cout<<"   "<<j*k<<endl;
        else
        cout<<"   "<<j*k;

}

另一种版本的九九乘法表

#include<iostream>
using namespace std;
int main()
{
    int j,k;
    for(j=1;j<=9;j++)
        {for(k=1;k<=j;k++)
            cout<<"j*k="<<j*k<<" ";
            cout<<endl;
    }
}

posted @ 2013-05-22 22:04  时间淡无痕  阅读(280)  评论(0编辑  收藏  举报