-
Notifications
You must be signed in to change notification settings - Fork 0
/
uri 1435.c
48 lines (48 loc) · 1.06 KB
/
uri 1435.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <stdio.h>
int main()
{
int a,b,c,d,e,f,g,h,i,j=1,N,p=0,q=0,r;
while(1)
{
scanf("%d", &N);
if(N==0)
break;
else
{
j=1;
p=0;
q=0;
int ara[N][N];
i=N;
if(N%2==0)
r=N/2;
else if(N%2==1)
r=(N/2)+1;
for(c=1; c<=r; c++)
{
for(a=p; a<i; a++)
{
for(b=q; b<i; b++)
ara[a][b]=j;
}
j++;
p++;
q++;
i--;
}
for(g=0; g<N; g++)
{
for(h=0; h<N; h++)
{
if(h==0)
printf("%3d",ara[g][h]);
else
printf(" %3d",ara[g][h]);
}
printf("\n");
}
printf("\n");
}
}
return 0;
}