#include
#define N 5
int main(int argc, char **argv)
{
int a[N][N]={0};
int i,j,row=0,col=N/2;
a[row][col]=1;
for(i=1;i {
if(0==i%N)
{
if(N-1==row)
{
row=-1;
}
row=row+1;
a[row][col]=i+1;
}
else
{
if(0==row)
{
row=N;
}
if(N-1==col)
{
col=-1;
}
row=row-1;
col=col+1;
a[row][col]=i+1;
}
}
for(i=0;i {
for(j=0;j {
printf("%d ", a[i][j]);
}
printf("\n");
}
printf("\n");
return 0;
}
阅读(1334) | 评论(0) | 转发(0) |