1084: 有趣的数字图形I
Time Limit: 1 Sec Memory Limit: 128 MBDescription
读入一个整数n(n<100),输出一个n*n的方阵。 对角线是1,对角线向右上逐渐递增,左下为空格,每个数场宽为5。
Input
一个整数n
Output
n*n的方阵
Sample Input
4
Sample Output
1 2 3 4
1 2 3
1 2
1
HINT
Source
#include<stdio.h>
main()
{
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{
if(i>j)printf("%5c",' ');
else
{
printf("%5d",j-i+1);
}
}
printf("\n");
}
}