Write a program which takes a single integer input "height" and displays a "pyramid"
of this height made up of "*" characters on the screen.
Sample Output:
Pick another height (must be between 1 and 30): the triangle must be equilataural
*
***
*****
*******
*********
***********
*************
Heba91
0
Newbie Poster
Recommended Answers
Jump to PostHow's your eyesight?
A bit fuzzy round the edges perhaps with looking at too many *'s (they're dots actually).
No?
How come you missed this then?
http://www.daniweb.com/forums/announcement9-2.html
Jump to PostUse 2 for loops for this.
int height=0; for(int i=0;i<height;i++) { for(int j:0;j<height;j++) { } }
That's a skeleton of what you need to do. It sounds like a homework assignment so fill in the blanks and it should work
Jump to Postmy problem is to make spaces before the stars
eg, your program needs to make a decision on whether to show a space or star.
All 9 Replies
Salem
5,138
Posting Sage
bsewell
0
Junior Poster in Training
Heba91
0
Newbie Poster
bsewell
0
Junior Poster in Training
Heba91
0
Newbie Poster
Salem
5,138
Posting Sage
Heba91
0
Newbie Poster
jwenting
1,889
duckman
Team Colleague
bsewell
0
Junior Poster in Training
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.