include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
int main()
{
int jsq=1,a[200][200],n;
cin>>n;
for(int i=1;i<=n;i)
{
if(i%2!=0)
{
for(int l=i,k=1;k<=i;k)
{
a[l][k]=jsq;
l–;
jsq;
}
}
else if(i%2==0)
{
for(int l=1,k=i;k>=1;k–)
{
a[l][k]=jsq;
l;
jsq;
}
}
}
for(int i=n-1;i>=1;i–)
{
if(i%2==0)
{
for(int k=i;k>=1;k–)
{
a[n-k+1][n-i+k]=jsq;
jsq;
}
}
if(i%2!=0)
{
for(int k=n;k>n-i;k–)
{
a[k][n+n-i+1-k]=jsq;
jsq;
}
}
}
for(int x=1;x<=n;x)
{
for(int y=1;y<=n;y++)
{
cout<<a[x][y]<<” “;
}
cout<<endl;
}
}