You are going to write a program that is going to use several nested loops. For full marks you must make effective use of nested loops. The first part of the program will ask for an integer in the range 1 to 15. It will then print a pattern using the numbers from 1 to the entered number. (The user input 7 in the output example that follows). The second part will print 3 asterisks and then ask the user if they want to keep going. If they type anything other than an upper or lower case n then the loop will continue. Each time print 3 more asterisks than the one before. See the sample output (here the user typed y three times and then typed an n to quit). Finally print the hour glass shaped set of asterisks that consists of two triangles each with 10 rows of asterisks.
Enter a number from 1-15 7 Output follows: 7654321 654321 54321 4321 321 21 1 1 21 321 4321 54321 654321 7654321 *** Keep going? y ****** Keep going? y ********* Keep going? y ************ Keep going? n ******************* ***************** *************** ************* *********** ********* ******* ***** *** * * *** ***** ******* ********* *********** ************* *************** ***************** ******************* |
____ 15 Gets valid input (3) Pattern with numbers (3) Keep going pattern (3) Hour glass pattern (3) Comments, Indentation & Readability (3)