Article directory
topic
Output a 9*9 multiplication table.
ideas
Considering the rows and columns, a total of 9 rows and 9 columns, double loop, i controls the row, j controls the column, and outputs a multiplication table.
Note the control format.
answer
#include <stdio.h>
int main()
{
int i,j,result;
printf("\n");
for (i=1;i<10;i++)
{
for(j=1;j<=i;j++)
{
result=i*j;
printf("%d*%d=%-3d",i,j,result); // -3d 表示左对齐,占 3 位
}
printf("\n"); // 每一行后换行
}
}