forked from aradhna7/MSIThactkober
-
Notifications
You must be signed in to change notification settings - Fork 0
/
double sided arrow.cpp
54 lines (53 loc) · 1.06 KB
/
double sided arrow.cpp
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
if(n%2!=0){
int i;
for(i=1;i<=(n+1)/2;i++){
int space;
for(space=1;space<=2*((n+1)/2)-2*i;space++){
cout<<" ";
}
int j;
for(j=i;j>=1;j--){
if(i==1){
cout<<" "<<j;}
else cout<<j<<" ";
}
int space2;
for(space2=1;space2<=2*i-3;space2++){
cout<<" ";
}
int k;
for(k=1;k<=i;k++){
if(i==1){
break;}
cout<<k<<" ";
}
cout<<endl;
}
for(i=((n+1)/2)-1;i>=1;i--){
int space;
for(space=1;space<=2*((n+1)/2)-2*i;space++){
cout<<" ";
}
int j;
for(j=i;j>=1;j--){
cout<<j<<" ";
}
int space2;
for(space2=2*i-3;space2>=1;space2--){
cout<<" ";
}
int k;
for(k=1;k<=i;k++){
if(i==1){
break;}
cout<<k<<" ";
}
cout<<endl;
}
}
}