Question: Write a complete program that: 1 . Uses a do . . . while loop to prompt the user to enter a count that is

Write a complete program that:1. Uses a do...while loop to prompt the user to enter a count that is greater than 1 and less than or equal to 20 then readsin a count from the keyboard as an integer.a. If input error occurs or the count the user enters is less than or equal to 1 or greater than 20, output an error.After outputting an error, clear/ignore the failed input and continue do...while looping until a valid number isentered.2. Writes a triangle to the display using for loops. The triangle will be upside down. To write this triangle to the display:a. amountOfStars = number entered in (1).b. Output amountOfStars followed by a new line.c. Decrement amountOfStars by one.d. Continue from (b) until amountOfStars is zero.3. Writes a triangle to the display using while loops. The triangle will be rightside up. To write this triangle to the display:a. amountOfStars =1.b. Output amountOfStars followed by a new line.c. Increment amountOfStars by one.d. Continue from (b) until amountOfStars is greater than the number entered in (1).

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 Programming Questions!