Skip to content

Commit b1e070b

Browse files
authored
Merge pull request #67 from pushkarmourya/Pyramid
added Pyramid.cpp
2 parents 43f0729 + 8aa4f52 commit b1e070b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

C++/42_Pyramid.cpp

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main()
5+
{
6+
int n;
7+
cin >> n;
8+
9+
// n is the number of lines to be printed
10+
11+
for (int i = 0; i < n; i++)
12+
{ // this for loop will be for number of lines
13+
14+
for (int j = 0; j <= i; j++)
15+
{ // for each line, we will print i+1 time of *
16+
cout << "*";
17+
}
18+
cout << "\n"; // seperating lines using newline
19+
}
20+
21+
return 0;
22+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ In the "Repository" you will find the topics and its problems.
9191
|39|[GCD](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/L)
9292
|40|[Lucky Numbers](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/M)
9393
|41|[Numbers Histogram](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/N)
94-
|42|[Pyramid](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/O)
94+
|42|[Pyramid](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/O) | [C++](./C++/42_Pyramid.cpp)
9595
|43|[Shape1](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/P)
9696
|44|[Digits](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/Q)
9797
|45|[Sequence of Numbers and Sum](https://codeforces.com/group/MWSDmqGsZm/contest/219432/problem/R)

0 commit comments

Comments
 (0)