-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern5.cpp
More file actions
31 lines (31 loc) · 896 Bytes
/
pattern5.cpp
File metadata and controls
31 lines (31 loc) · 896 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
#include <iostream>
using namespace std;
int main(){
int i,j,n;
cin>>n; // *
for(i=1;i<=n;i++){ // ***
for(j=1;j<60;j++){ // *****
cout<<" "; // *******
} // *********
for(j=n;j>=i;j--){ // *******
cout<<" "; // *****
} // ***
for(j=1;j<=(2*(i-1)+1);j++){ // *
cout<<"*"; // Diamond Star Pattern
}
cout<<endl;
}
for(i=(n-1);i>=1;i--){
for(j=1;j<60;j++){
cout<<" ";
}
for(j=i;j<=n;j++){
cout<<" ";
}
for(j=(2*(i-1)+1);j>=1;j--){
cout<<"*";
}
cout<<endl;
}
return 0;
}