Question: The C++ program should ask the user the initial number of asterisks it will display in the first row after the input. The C++ program

The C++ program should ask the user the initial number of asterisks it will display in the first row after the input. The C++ program then should display a decreasing number of asterisks in the succeeding row until it reaches a single asterisk. The C++ program should also display the total number of asterisks printed on the screen.

Fill in the blanks in the incomplete C++ program:

#include

using namespace std;

int main() {

int x, no, y, total = 0;

cout << "How many stars? ";

cin >> no;

for (x = no; _____________; x--) {

total = _____________

for (_____________; y > 0; y--)

cout << "*";

cout << " ";

}

cout << "Wow " << total << " stars in all!!!";

return 0;

}

The output should be:

How many stars? 6

******

*****

****

***

**

*

Wow 21 stars in all!!!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!