-
Notifications
You must be signed in to change notification settings - Fork 0
/
13.cpp
94 lines (88 loc) · 1.89 KB
/
13.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// * * * * * * * * * * * *
// * * * * *
// * * * * * * * *
// * * * * *
// * * * * *
// * * *
#include<stdio.h>
int main(int argc, char const *argv[])
{
int n, m, o;
printf("Enter any number: ");
scanf("%d", &n);
m = n * 2 - 1;
o = (n + 1 ) / 2;
int count = (n / 2) + 2;
// Initial 'T'
for (int i = 0; i < n + 1; i++) {
if (i == 0)
{
for (int j = 0; j < n; ++j)
{
printf("* ");
}
} else {
for (int k = 0; k < n - 1; ++k)
{
printf(" ");
}
printf("*");
}
printf("\n");
}
// // For Space between initials
// for (int i = 0; i < n; ++i)
// {
// for (int j = 0; j < 2; ++j)
// {
// printf(" ");
// }
// printf("\n");
// }
printf("\n\n");
// Initial 'R'
// Upper part
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= m; ++j)
{
if (i == 1 || j == m || i == n || j == 1)
printf("* ");
else
printf(" ");
}
printf("\n");
}
//Lower part
for (int i = 1; i < m; ++i)
{
for (int j = 0; j < m; ++j)
{
if (i == j || j == 0)
printf("* ");
else
printf(" ");
}
printf("\n");
}
printf("\n\n");
// Initial 'K'
for (int i = 1; i <= n; ++i)
{
for (int j = 1; j <= n; ++j)
{
if (j == 1 || count == j)
printf("* ");
else
printf(" ");
}
if (i < (n / 2) + 1)
{
count--;
} else {
count++;
}
printf("\n");
}
return 0;
}