wood burning stoves*
The moose likes Beginning Java and the fly likes help with loop constructs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with loop constructs" Watch "help with loop constructs" New topic
Author

help with loop constructs

Khair Bahir
Greenhorn

Joined: Aug 01, 2011
Posts: 14
I'm trying to design a program that will display the following:

*****
****
***
**
*

I'm sure there is some way to use loop constructs to make even 100 rows of the previous message, but I'm not sure how.

I was thinking of using a 'for' construct to generate numbers from 5 to 1, and then assigning each number to a certain number of *, but even this I don't know how to do.

Is there a better approach?

Thanks.
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Welcome to JavaRanch.

Your approach sounds about right. Try coming up with a pseudocode which would detail every step of the program.

then assigning each number to a certain number of *

This would be another 'for' construct within the original 'for'.
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Search the forums as well. I think there was a similar post sometime last week.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help with loop constructs