File tree Expand file tree Collapse file tree 1 file changed +81
-0
lines changed Expand file tree Collapse file tree 1 file changed +81
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream.h>
2
+ #include < conio.h>
3
+ void main ()
4
+ {
5
+ clrscr ();
6
+ int n,i,j,k;
7
+ cout<<" Enter Value Of n: " ;
8
+ cin>>n;
9
+ int space=n-1 ;
10
+ for (i=1 ; i<=n;i++)
11
+ {
12
+ cout<<endl;
13
+ for (k=space; k>=1 ;k--)
14
+ {
15
+ cout<<" " ;
16
+ }
17
+ space--;
18
+ for (j=1 ; j<=i; j++)
19
+ cout<<j;
20
+ for (j=i-1 ; j>=1 ; j--)
21
+ cout<<j;
22
+ }
23
+ cout<<endl;
24
+ // -------------------------------------------------------------------
25
+ cout<<endl;
26
+ cout<<" Enter Value Of n: " ;
27
+ cin>>n;
28
+ space=n-1 ;
29
+ for (i=1 ; i<=n;i++)
30
+ {
31
+ cout<<endl;
32
+ for (k=space;k>=1 ;k--)
33
+ cout<<" " ;
34
+ for (j=1 ; j<=(2 *i)-1 ; j++)
35
+ cout<<' *' ;
36
+ space--;
37
+ }
38
+ space=1 ;
39
+ for (i=1 ; i<=n-1 ; i++)
40
+ {
41
+ cout<<endl;
42
+ for (k=space;k>=1 ; k--)
43
+ cout<<" " ;
44
+ for (j=1 ;j<=2 *(n-i)-1 ;j++)
45
+ cout<<' *' ;
46
+ space++;
47
+ }
48
+ getch ();
49
+ }
50
+
51
+ /*
52
+ Enter Value Of n: 5
53
+
54
+
55
+ 1
56
+ 121
57
+ 12321
58
+ 1234321
59
+ 123454321
60
+
61
+ Enter Value Of n: 6
62
+
63
+ *
64
+ ***
65
+ *****
66
+ *******
67
+ *********
68
+ ***********
69
+ *********
70
+ *******
71
+ *****
72
+ ***
73
+ *
74
+
75
+ */
76
+
77
+
78
+
79
+
80
+
81
+
You can’t perform that action at this time.
0 commit comments