#include <stdio.h>
int main()
{
int a, b, c;
for (a = 1; a < 10; a++)
{
for (b = 1; b < 10; b++)
{
c = a * b;
printf("%d X %d= %d ", a, b, c);
}
printf("\n");
}
return 0;
}
改变部分代码 b<10改为b<=a
#include <stdio.h>
int main()
{
int a, b, c;
for (a = 1; a < 10; a++)
{
for (b = 1; b <= a; b++)
{
c = a * b;
printf("%d X %d= %d ", a, b, c);
}
printf("\n");
}
return 0;
}