-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpattern4.cpp
47 lines (40 loc) · 881 Bytes
/
pattern4.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
/*Lecture 4.1.4: Awesome Pattern Question-4 */
/* Half Pyramid After 180* degree Rotation pattern Question
Agar ye pattern question humko n=5 de rakha hai too usse hum kaise banayege pyramid
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
humko sabse pehle har row me space print karni hogi, then stat print hogya.
*/
#include<iostream>
using namespace std;
int main() {
int num;
cout<<"Enter Number Here: ";
cin>>num;
//row
for(int i=1; i<=num; i++) {
//for columns
for(int j=1; j<=num; j++) {
if(i<=num-j) {
cout<<" ";
} else {
cout<<"* ";
}
}
cout<<endl;
}
}
/*Output:
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
*/