All pastes #718717 Raw Edit

pyramid

public cpp v1 · immutable
#718717 ·published 2007-09-28 17:18 UTC
rendered paste body
for(int row=0;row<7;row++}{//Pad leading blanks in a row using a loop like this:for(int column=1;column<(7-row);column++){cout << "   ";}//Print left half of the row for numbers 1, 2, 4, up to 2^row using a look like this:for(int column=0;column<row;column++){cout << "    " << pow(2, column);}//Print the right half of the row for numbers 2^row-1, 2^row-2, ...., 1; column >=0; col--)for (int column=row-1; column >=0; column--){cout << "    " << pow (2, column);}//Start a new linecout << endl;}