-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpattern3.cpp
More file actions
59 lines (41 loc) · 951 Bytes
/
pattern3.cpp
File metadata and controls
59 lines (41 loc) · 951 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*Write pseudo-codes which reads number of lines N and prints the following patterns. [Two
different pseudo-code for both patterns
*
***
*****
*******
*****
***
*
*/
#include <iostream>
using namespace std;
int main(){
int N;
cout<<"Enter the number N";
cin>>N;
for(int j = (N/2),i=0;j>=0,i<=(N/2);i++,j--){
for(int k = 0;k<j;k++){
cout<<" ";
}
for(int k =0;k<=i;k++){
cout<<"*";
}
for(int k=0;k<i;k++){
cout<<"*";
}
cout<<endl;
}
for(int j = 1,i=(N/2);j<=(N/2),i>=0;i--,j++){
for(int k = 0;k<j;k++){
cout<<" ";
}
for(int k = 0;k<=i-1;k++){
cout<<"*";
}
for(int k = 0;k<i-1;k++){
cout<<"*";
}
cout<<endl;
}
}