Homework 13
Write a program that uses nested for loops to generate an inverted right triangle with n asterisks (where n is in the range 1...20) such that the first row has one asterisk; the second has two, and so on. You MAY assume that the user enters an integer, but you must test the users input to make sure that the n entered is in the range (1..20) and use a loop to continue prompting for valid input before completing the program. Right-align the asterisks on each row such as shown in the following run. Write ALL output produced by your program BOTH to the screen and to a file called hw13.txt. You might find this program, which creates a non-inverted right triangle of right aligned asterisks, to be helpful. Notice though that this problem does NOT check that num_rows is valid, which you must do.
*** Sample run ***
How many rows (1-20)? -3
*** OUT OF RANGE!
How many rows
(1-20)? 22
*** OUT OF RANGE!
How many rows
(1-20)? 5
*****
****
***
**
*
As you write this program, try to make use of the process of stepwise refinement that we discussed in lecture.
Turn In a printout of your program and a screen capture showing it run with user inputting -8, then -3, then 10 at the input prompts, as well as a copy of your hw13.txt output file.