Nested Counting Loops Exercise
This is a loop nesting exercise. Use two loops, including at least one for
loop, to write a C++ program that prints out an upside down triangle of stars to the screen.
Write a program from scratch
- Add code to template file
ex3_stars.cpp
in the replit team project or create it in your IDE. - The user will enter the number of stars in the first line, then nested loops will print the triangle of stars.
For example:How many stars on the first line? 5 ***** **** *** ** *How many stars on the first line? 2 ** *
Tips:
- try starting with a counting for loop that counts down from the number the user entered to 1 like this:
How many stars on the first line? 5 5 4 3 2 1
When you are done:
- Take screenshots demonstrating two different sizes of star triangle.
- For this exercise, you will have:
ex3_stars.cpp
. - If you have completed Exercises 1,2 and 3, congratulations! Option 1 is complete! Please download a zip file from replit and upload it to URCourses.