4
* *** ***** *******
void pattern_q6_pyramid() {
int n = 5;
for(int i = 1; i <= n; i++) {
// Print spaces
for(int j = 1; j <= n - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
}
void pattern_q6_pyramid() {
int n = 5;
for(int i = 1; i <= n; i++) {
// Print spaces
for(int j = 1; j <= n - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
}