Question: Problem 2 Write a recursive function hourglass ( base ) that prints an hour glass to the screen using asterisks. The function has a single

Problem 2
Write a recursive function hourglass (base) that prints an hour glass to the screen using asterisks. The function has a single paramater, base, an int
which indicates how many asterisks will be used at the top and bottom levels of the hour glass. Each successive level of the hourglass should have
two fewer asterisks in it. The successive levels should be centered. Once the level has 1 or 2 asterisks it should repeat that level, then invert and grow
by two asterisks until it reaches the base level. This should work for both even and odd inputs.
You do not have to deal with inputs less than 3.
Sample usage:
hourglass (5)
**********
******
******
**********
hourglass (8)
******************
************
********
****
****
********
************
******************
hourglass (3)
******
**
******
 Problem 2 Write a recursive function hourglass (base) that prints an

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