Program Logic

Hi there i'm trying to find the logic behind the following question.

Write a C++ program with a nested loop structure that displays the following pyramid in "*":

******
********
**********
************
**************
****************
*****************
********************

It is supposed to be a pyramid built in *'s the first row starting with 6 and the last row with 20 stars.

Last edited on
This is a problem that every intro programming class introduces. Take a look at the various looping techniques here: http://www.cplusplus.com/doc/tutorial/control.html

Try it first. Then, if you run into a specific problem, people will be happy to help.
Here is a hint:

Two for-loops.

The outer loop starts at 6 and goes to 20.

The inner loop starts at 0 and goes to the outer loop value

You figure out how to make the stars print.
Last edited on
Topic archived. No new replies allowed.