想搞个环可老错,帮忙看看!!!
#include <stdio.h>void main()
{
int i,j,col,row;
int a[100][100];
scanf("%d,%d",&col,&row);
int small=col<row?col:row;
int count=small/2;
for(i=0;i<count;i++)
{
int C=col-1-i;
int R=row-1-i;
int cc=C-i;
int rr=R-i;
int s=2*i*(col+row-2*i)+1;
for(int j=i, k=s;j<C;j++) {a[i][j]=k++;printf("%3d",a[i][j]);}
for(int j=i, k=s+cc;j<R;j++) {a[j][C]=k++;printf("%3d",a[j][C]);}
for(int j=C, k=s+cc+rr;j>i;j--) {a[R][j]=k++;printf("%3d",a[R][j]);}
for(int j=R, k=s+2*cc+rr;j>i;j--) {a[j][R]=k++;printf("%3d",a[j][R);}
}
}