-
Notifications
You must be signed in to change notification settings - Fork 1
/
pattern_alphabet_diamond.c
97 lines (80 loc) · 2.42 KB
/
pattern_alphabet_diamond.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
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
95
96
97
/*
Does this awesome thing :-P
-----------------------------o-----------------------------
---------------------------o-n-o---------------------------
-------------------------o-n-m-n-o-------------------------
-----------------------o-n-m-l-m-n-o-----------------------
---------------------o-n-m-l-k-l-m-n-o---------------------
-------------------o-n-m-l-k-j-k-l-m-n-o-------------------
-----------------o-n-m-l-k-j-i-j-k-l-m-n-o-----------------
---------------o-n-m-l-k-j-i-h-i-j-k-l-m-n-o---------------
-------------o-n-m-l-k-j-i-h-g-h-i-j-k-l-m-n-o-------------
-----------o-n-m-l-k-j-i-h-g-f-g-h-i-j-k-l-m-n-o-----------
---------o-n-m-l-k-j-i-h-g-f-e-f-g-h-i-j-k-l-m-n-o---------
-------o-n-m-l-k-j-i-h-g-f-e-d-e-f-g-h-i-j-k-l-m-n-o-------
-----o-n-m-l-k-j-i-h-g-f-e-d-c-d-e-f-g-h-i-j-k-l-m-n-o-----
---o-n-m-l-k-j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j-k-l-m-n-o---
-o-n-m-l-k-j-i-h-g-f-e-d-c-b-a-b-c-d-e-f-g-h-i-j-k-l-m-n-o-
---o-n-m-l-k-j-i-h-g-f-e-d-c-b-c-d-e-f-g-h-i-j-k-l-m-n-o---
-----o-n-m-l-k-j-i-h-g-f-e-d-c-d-e-f-g-h-i-j-k-l-m-n-o-----
-------o-n-m-l-k-j-i-h-g-f-e-d-e-f-g-h-i-j-k-l-m-n-o-------
---------o-n-m-l-k-j-i-h-g-f-e-f-g-h-i-j-k-l-m-n-o---------
-----------o-n-m-l-k-j-i-h-g-f-g-h-i-j-k-l-m-n-o-----------
-------------o-n-m-l-k-j-i-h-g-h-i-j-k-l-m-n-o-------------
---------------o-n-m-l-k-j-i-h-i-j-k-l-m-n-o---------------
-----------------o-n-m-l-k-j-i-j-k-l-m-n-o-----------------
-------------------o-n-m-l-k-j-k-l-m-n-o-------------------
---------------------o-n-m-l-k-l-m-n-o---------------------
-----------------------o-n-m-l-m-n-o-----------------------
-------------------------o-n-m-n-o-------------------------
---------------------------o-n-o---------------------------
-----------------------------o-----------------------------
*/
#include<stdio.h>
void main()
{
int i,j,n,s,in,dn,ind,dnd;
printf("enter the number: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("\n");
for(s=i;s<=n*2-i;s++)
{
printf("-");
}
for(dn=n;dn>=n-i+1;dn--)
{
printf("%c-",'a'+dn-1);
}
for(in=n-i+2;in<=n;in++)
{
printf("%c-",'a'+ in-1);
}
for(s=i;s<n*2-i;s++)
{
printf("-");
}
}
for(j=n;j>1;j--)
{
printf("\n");
for(s=j;s<=n*2-j+2;s++)
{
printf("-");
}
for(dnd=n;dnd>n-j+1;dnd--)
{
printf("%c-",'a'+ dnd-1);
}
for(ind=n-j+3;ind<=n;ind++)
{
printf("%c-",'a'+ ind-1);
}
for(s=j-1;s<=n*2-j;s++)
{
printf("-");
}
}
printf("\n\n");
}