编写一个C程序,用于打印九九乘法表

2024-12-21 21:52:04
推荐回答(3个)
回答1:

#include
main()
{
int a=1,b=1,n;
while(a<=9)
{
b=1;
while(b<=a)
{
printf("%d*%d=%d ",b,a,a*b);
b++;
}
printf("\n");
a++;
}
system("pause");
}

回答2:

//using for loop
#include
void main()
{
int a,b;
for(a=1;a<10;a++)
{
for(b=1;b<=a;b++)
{
printf("%d*%d=%2d ",a,b,a*b);
}
printf("\n");
}
}

回答3:

main()
{
int i=1,j=1,k;
while(i<=9)
{
j=1;
while(j<=i)
{
printf("%d*%d=%d ",i,j,i*j);
j++;
}
printf("\n");
i++;
}
getch();
}