#include <stdio.h> #include <stdlib.h> #define MAX 100 void pr(int n, int squ[][MAX]); void square(int n, int squ[][MAX]); int make_num(); int main(void) { int n, squ[MAX][MAX]={0}; scanf("%d", &n); square(n, squ); pr(n, squ); return 0; } int make_num(){ static int a=0; int b; b=((a++)%26)+'A'; return b; } void pr(int n, int squ[][MAX]) { int i, j; for(i=0; i<2*n; i++) { for(j=0; j<2*n; j++) { if(squ[i][j]==0) printf(" "); else printf("%c ", squ[i][j]); } printf("\n"); } //system("pause"); //system("cls"); } void square(int n, int squ[][MAX]) { int x=0, y=n-1, c1=1, c2=n, a=0, i; for(i=0; i<n; i++) { while(x<c2) squ[x++][y--]=make_num(); y+=2; while(x<(2*c2)-c1) squ[x++][y++]=make_num(); x-=2; while(y<(2*c2)-c1) squ[x--][y++]=make_num(); y-=2; while(y>=c2) squ[x--][y--]=make_num(); x++; c1++; } }