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.
faisal.alawar
0
Newbie Poster
Recommended Answers
Jump to PostThis 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 …
Jump to PostNew_members_chased_away_this_month ++;
All 9 Replies
Narue
5,707
Bad Cop
Team Colleague
faisal.alawar
0
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
Salem
5,138
Posting Sage
faisal.alawar
0
Newbie Poster
Narue
5,707
Bad Cop
Team Colleague
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
jonsca
commented:
Nice
+1
Rahul.menon
0
Light Poster
prvnkmr449
-8
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.