+ 2

Program to print this

& & & & & & & Howwwww?????????

22nd Oct 2016, 2:16 PM
Jishnu
Jishnu - avatar
2 Respuestas
+ 2
You'll need to use a nested for loop: int rows; cout << "Enter how high you want the pyramid to be: "; cin >> rows; int columns = (rows * 2) - 1; for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { if (j == (rows - i - 1) || j == (rows + i - 1)) cout << "&"; else cout << " "; } cout << endl; } try this and see if it works...I haven't actually tested it; i just wrote is right here haha. and if it doesn't work, you can fix it, I'm sure!
22nd Oct 2016, 7:16 PM
Zeke Williams
Zeke Williams - avatar
- 1
i don't know
22nd Oct 2016, 2:22 PM
Emranul haque
Emranul haque - avatar