#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i=0, j=0, k=0;
int n = 1;
int arr[20][20];
for ( ; n<=25 ; k++ )
{
for ( i=k,j=k ; 5-k>j ; j++, n++ )
{
arr[i][j] = n;
}
for ( i=k+1,j=5-1-k ; 5-k>i ; i++, n++ )
{
arr[i][j] = n;
}
for ( i=5-1-k, j=5-2-k ; k<=j ; j--, n++ )
{
arr[i][j] = n;
}
for ( i=5-2-k, j=k ; k<i ; i--, n++ )
{
arr[i][j] = n;
}
}
for ( i=0 ; 5>i ; i++ )
{
for ( j=0 ; 5>j ; j++ )
{
printf (" %3d", arr[i][j]);
}
printf("\n");
}
system("pause");
return 0;
}