Write a program that prompts the user for an odd positive integer, n, greater than 1, and then
prints the following hourglass figure which has a height of n text lines:
In this example: n = 9
********* (please refer to the attachment for the figure)
Your program should check that the user enters a valid number for n and print an error message
if not. Make sure to use the right method. Your output should look exactly like the figure above:
symmetric and left-justified, with all stars * and spaces in the locations as shown. It should be
scaled appropriately for the given value of n. Please make sure that your program works for all
valid cases (e.g. check for n=3). It is recommended to break the entire job into small tasks to
handle each region of the figure. Make sure to use loops.
Jump to Post
This is a trivial homework assignment and we won't help you cheat. Do it yourself.
Jump to Post
>i thaught that this website was usefull
It is...for people who are interested in learning and ask real questions. All you did was post code hoping someone would solve all your problems for you.
>but it turned out that all its members are arrogant
I strongly recommend that you …
All 9 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.