请求注释这个一for循环嵌套两个if语句的程序!
#include "stdio.h"main()
{int a[20][20];
int i,j,n,x,y,x1,y1,n1,sum;
printf("请你输入n:");
scanf("%d",&n);
n1=n; sum=n; x=0; y=1; x1=1; y1=0;
for (i=1;i<=n*n;i++)
{ x=x+x1;y=y+y1;a[x][y]=i ;
if (i==sum)
{ if(x1==1 || x1==-1 )
{ n1=n1-1;
sum=sum+n1;
y1=x1;
x1=0;
}
else
{sum=sum+n1;
x1=-y1;
y1=0;
}
}
}
for (i=1;i<=n;i++)
{ for (j=1;j<=n;j++)
printf(" %3d",a[j][i]);
printf("\n");
}
return 0;