Question: Write a program pyramid.cpp that reads a positive while number n and prints a pyramid ... So far I have: int n,i,j,k (0); while (n%2
Write a program "pyramid.cpp" that reads a positive while number n and prints a pyramid ...

So far I have:
int n,i,j,k (0);
while (n%2 == 0 || n
cout
cin >> n; }
for (i = 1; i
for (j=1; j
cout
}
for (k =i; ....... and then i get stuck. :-( I have tried a lot of variations, i can't seem to get it right. And i'm not sure if i should use (for the first for loop) i Write a program pyramid.cpp that reads a positive odd whole number n and prints a pyramid where the first row contains all numbers from 1 to n (i.e., ascending order), the second row displays all numbers from 2 to n 1, the third row displays all numbers from 3 to n-2, etc The last row will contain only a single value, i.e. the middle value in the range, i.e. 1 to n. Each successive row contains two fewer values than the previous row, i.e. the two values at the ends of the previous row are missing For example, if n is 9, then the program will output 123456789 2345678 34567 456 If n is 13, then the program will output 1234567890123 23456789012 345678901 4567890 56789 678 The i'th row contains n - (2i - 2) values. Each column displays the same number. If a row has more than 10 digits, the digit after 9 should start again from 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
