The first for loop controls the multiplication list to have x rows, and the second for loop controls the yth row to have y columns.
\t means data alignment output
#include<stdio.h>intmain(){
int m,x,y;scanf("%d",&m);for(x=1;x<=m;x++){
for(y=1;y<=x;y++){
printf("%d*%d=%d\t ",y,x,x*y);}printf("\n");}return0;
}
If the multiplication list is output in reverse, the first for loop controls the multiplication list to have x rows, and the second for loop controls the xth row to have x-y+1 columns.
The effect of %nd is to occupies the width of n characters when outputting the corresponding variable, and the left part of the insufficient part is filled with a space
#include<stdio.h>intmain(){
int x,y;scanf("%d",&x);for(;x>=1;x--){
for(y=1;y<=x;y++){
printf("%2d*%2d=%2d ",y,x,y*x);}printf("\n");}return0;}