Skip to content

Commit d52cd94

Browse files
committed
upload file
1 parent 452fbfc commit d52cd94

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

patterns/hollowDiamond.cpp

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

0 commit comments

Comments
 (0)