~cpp
#include <iostream.h>
int main()
{
int a[5][5]={{0, },};
int x, y ;
a[0][2]=1;
x=2;
y=0;
for(int count=2;count<26;count++)
{
x--;
y--;
if(y==-1)
y=4;
if(x==-1)
x=4;
if(a[y][x]!=0)
{
y+=2;
x++;
}
if(y>4)
y=1;
if(x>4)
x=0;
a[y][x]=count;
}
for(int i=0;i<5;i++)
{
for(int j=0;j<5;j++)
cout<<a[i][j]<<"\t ";
cout<<endl;
}
return 0;
}










