Welcome

首页 / 软件开发 / C语言 / 输出九九乘法口诀表

输出九九乘法口诀表2011-10-13 本站 smiling cat

题目:输出9*9乘法口诀表

1.程序分析:分行与列考虑,共9行9列,i控制行,j控制列。

2.程序源代码:

#include "stdio.h"
#include "conio.h"
main()
{
int i,j,result;
printf(" ");
for (i=1;i<10;i++)
{
for(j=1;j<10;j++)
{
result=i*j;
printf("%d*%d=%-3d",i,j,result); /*-3d表示左对齐,占3位*/
}
printf(" "); /*每一行后换行*/
}
getch();
}
3.Visual C++ 6.0下调试通过,如图: