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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started