Skip to content

Commit 452fbfc

Browse files
committed
Upload file
1 parent cbb6e94 commit 452fbfc

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

patterns/leftRightLeanedDiamond.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#include <iostream>
2+
3+
using namespace std;
4+
5+
int main()
6+
{
7+
int num;
8+
cin >> num;
9+
10+
for(int i=1; i<=2*num; i++){
11+
for(int j=1; j<=2*num; j++){
12+
13+
if((j<=i && i+j <= 2*num+1) || (i+j >= 2*num+1 && j >=i))
14+
cout << "* ";
15+
else
16+
cout << " ";
17+
}
18+
cout << endl;
19+
}
20+
21+
return 0;
22+
}

0 commit comments

Comments
 (0)