4
* *** ***** ******* ***** *** *
void control_q13_diamond_pattern() {
int rows = 5;
// Upper part
for(int i = 1; i <= rows; i++) {
// Print spaces
for(int j = 1; j <= rows - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
// Lower part
for(int i = rows - 1; i >= 1; i--) {
// Print spaces
for(int j = 1; j <= rows - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
}
void control_q13_diamond_pattern() {
int rows = 5;
// Upper part
for(int i = 1; i <= rows; i++) {
// Print spaces
for(int j = 1; j <= rows - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
// Lower part
for(int i = rows - 1; i >= 1; i--) {
// Print spaces
for(int j = 1; j <= rows - i; j++) {
cout << " ";
}
// Print stars
for(int k = 1; k <= 2*i - 1; k++) {
cout << "*";
}
cout << endl;
}
}