-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpattern_27.cpp
More file actions
31 lines (29 loc) · 745 Bytes
/
pattern_27.cpp
File metadata and controls
31 lines (29 loc) · 745 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 n;
cout << "Enter the number of rows : ";
cin >> n;
for (int i = 0; i <= n; i++)
{
for (int j = 0; j < n - i; j++)
{
cout << " ";
}
for (int star = 0; star < 2 * i + 1; star++)
{
cout << "*";
}
cout << endl;
}
return 0;
}
/*
Output n = 5
*
* * *
* * * * *
* * * * * * *
* * * * * * * *
*/