#include<stdio.h>
#pragma warning(disable:4996)
int main()
{
int i = 0;
int j = 0;
for (i = 1; i<=9; i++)
{
for (j = 1; j <= i; j++)
{
printf("%d*%d=%d ", i, j, i*j);
}
printf("\n");
}
system("pause");
return 0;
}
若考虑到乘积后边的一位数与两位数对齐,则应
#include<stdio.h>
#pragma warning(disable:4996)
int main()
{
int i = 0;
int j = 0;
for (i = 1; i<=9; i++)
{
for (j = 1; j <= i; j++)
{
printf("%d*%d=%2d ", i, j, i*j);//%2d使得一位数字与两位数字对齐
}
printf("\n");
}
system("pause");
return 0;
}