View Single Post
  #1 (permalink)  
Old 10-06-2008, 03:49 PM
GeeKunMow GeeKunMow is offline
Member
 
Join Date: Oct 2008
Posts: 4
GeeKunMow is on a distinguished road
Star pattern help?
I need some help making some star patterns. The exact instructions are as follows:

Create separate programs to produce the following patterns:
a.
*
**
***
****
*****

b.
*****
****
***
**
*


I have to use for loops to get the patterns and I've already got (a.) but I can't seem to get the second. My first pattern's code is this:

public class Stars
{
//-------------------------------------------
//Prints a triangle shape using asterick (star) characters.
//-----------------------------------------------------------
public static void main (String[] args)
{
final int MAX_ROWS = 10;

for (int row = 1; row <= MAX_ROWS; row++)
{
for (int star = 1; star <= row; star++)
System.out.print ("*");

System.out.println();
}
}
}
Please help? Thanks in advance!
Reply With Quote
Sponsored Links