1058: 数字走向III
Time Limit: 1 Sec Memory Limit: 128 MBDescription
输入整数N,输出相应方阵。
Input
一个整数N。( 0 < n < 10 )
Output
一个方阵,每个数字的场宽为3。
Sample Input
5
Sample Output
1 6 11 16 21
2 7 12 17 22
3 8 13 18 23
4 9 14 19 24
5 10 15 20 25
HINT
Source
#include<stdio.h>
main()
{
int N;
scanf("%d",&N);
for(int i=1;i<=N;i++)
{
for(int j=i;j<=N*N-N+i;j+=N)
{printf("%3d",j);}
printf("\n");
}
}