We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f51085 commit 5800d23Copy full SHA for 5800d23
Patterns/PyramidPattern.cpp
@@ -0,0 +1,33 @@
1
+#include <iostream>
2
+using namespace std;
3
+
4
+int main()
5
+{
6
7
+ int n = 4;
8
9
+ for (int i = 0; i < n; i++)
10
+ {
11
+ // spaces
12
+ for (int j = 0; j < n - i - 1; j++)
13
14
+ cout << " ";
15
+ }
16
17
+ // num 1
18
+ for (int j = 1; j <= i + 1; j++)
19
20
+ cout << j;
21
22
23
+ // num 2
24
+ for (int j = i; j >= 1; j--)
25
26
27
28
29
+ cout << endl;
30
31
32
+ return 0;
33
+}
Patterns/PyramidPattern.exe
43.8 KB
0 commit comments