Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

this is in c++ #include using namespace std; int main() { int rows; cout < < Enter how many stars you want in the first

this is in c++

#include using namespace std;

int main() { int rows; cout << "Enter how many stars you want in the first row "; cin >> rows; for(int x= rows; x>=1; --x) { for(int a=1;x<=a;++a) { cout<<"*"; } cout << endl; } return 0; }

why is it an infinite loop im trying for this to happen

Using a nested for loop write commented code that prompts the user enter a positive number and then uses that number to create rows of decreasing asterixes all the way to 1

for example if the user enters 8 you output

********

*******

******

*****

****

***

**

*

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions