[ create a new paste ] login | about

Link: http://codepad.org/7CYWv5g6    [ raw code | output | fork ]

C++, pasted on Dec 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
int main()
{
int n = 0;
//scanf("%d", &n);
n = 5;
for (int i = 0; i <= 2*n; i++)
{
for (int j = 0; j <= 2*n; j++)
{
if (i == j || i + j == 2*n) {printf("1\t"); continue;}
if (j > i && j < 2* n - i && i < n) { printf("2\t"); continue; }
if (j < i && j > 2* n - i && i > n) { printf("3\t"); continue; }
if (j < i && j < 2* n - i)  { printf("4\t"); continue; }
if (j > i && j > 2* n - i)   { printf("5\t"); continue; }
 printf("-\t");
}
printf("\n");
}
}


Output:
1
2
3
4
5
6
7
8
9
10
11
1	2	2	2	2	2	2	2	2	2	1	
4	1	2	2	2	2	2	2	2	1	5	
4	4	1	2	2	2	2	2	1	5	5	
4	4	4	1	2	2	2	1	5	5	5	
4	4	4	4	1	2	1	5	5	5	5	
4	4	4	4	4	1	5	5	5	5	5	
4	4	4	4	1	3	1	5	5	5	5	
4	4	4	1	3	3	3	1	5	5	5	
4	4	1	3	3	3	3	3	1	5	5	
4	1	3	3	3	3	3	3	3	1	5	
1	3	3	3	3	3	3	3	3	3	1	


Create a new paste based on this one


Comments: