输入一个正整数n(1≤n≤10),打印一个n行n列的方阵。当n=4时,打印如下方阵:
13 14 15 16
9 10 11 12
5 6 7 8
1 2 3 4
#include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i, j, n;
scanf("%d", &n);
for(i=n-1;i>=0;i--){
for(j=1;j <=n;j++){
printf("%4d",4*i+j);
}
printf("\n");
}
return 0;
}