#include<iostream>
using namespace std;
int q[100][100];
int main()
{
int n;
while(cin>>n,n)
{
for(int i=0;i<n;i++)
{
q[i][i]=1;//对角线
for(int j=i+1,k=2;j<n;j++,k++)q[i][j]=k;
for(int j=i+1,k=2;j<n;j++,k++)q[j][i]=k;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<q[i][j]<<' ';
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
12-31
08-06
4997
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交