-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathH_Pattern.cpp
More file actions
39 lines (39 loc) · 776 Bytes
/
H_Pattern.cpp
File metadata and controls
39 lines (39 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Author : pk
// H pattern
/*
# #
## ##
### ###
#### ####
##### #####
############
############
##### #####
#### ####
### ###
## ##
# #
*/
#include<iostream>
using namespace std;
int main(){
int n,i,a,b,c,x;
cin >> n;
for(i=1;i<=n;i++){
for(a=1;a<=i-1;a++) cout << " ";
for(b=1;b<=i;b++) cout << "#";
int x= (4*n-2)-(2*(a+b-2));
for(c=1;c<=x;c++) cout << " ";
for(b=1;b<=i;b++) cout << "#";
cout << endl;
}
for(i=n;i>=1;i--){
for(a=1;a<=i-1;a++) cout << " ";
for(b=1;b<=i;b++) cout << "#";
int x= (4*n-2)-(4*i-2);
for(c=1;c<=x;c++) cout << " ";
for(b=1;b<=i;b++) cout << "#";
cout << endl;
}
return 0;
}