- Mar 11, 2005
- 2
- 0
- 0
ok so i get how to do the first triangle and here's the code i came up with for it:
public void starsA()
{
final int MAX_ROWS = 6;
for(int row = 1; row <=MAX_ROWS; row++)
{
for(int star =1; star <=row; star++)
System.out.print ("*");
System.out.println();
}
}
however, I'm lost as to how to code the rest... (esp. the diamond) using loops. like I know that you also have incorporate some space delimiters in the code, but that's about it.
any help would be greatly appreciated
edit: didn't know there was an attach code button. sorry!
public void starsA()
{
final int MAX_ROWS = 6;
for(int row = 1; row <=MAX_ROWS; row++)
{
for(int star =1; star <=row; star++)
System.out.print ("*");
System.out.println();
}
}
however, I'm lost as to how to code the rest... (esp. the diamond) using loops. like I know that you also have incorporate some space delimiters in the code, but that's about it.
any help would be greatly appreciated
edit: didn't know there was an attach code button. sorry!
