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
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 or 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
Sample usage:
hourglass
hourglass
hourglass
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
