I am trying to write a program for an assignment that uses a For loop to produce an output that looks like this:
* ********** ********** *
** ********* ********* **
*** ******** ******** ***
**** ******* ******* ****
***** ****** ****** *****
****** ***** ***** ******
******* **** **** *******
******** *** *** ********
********* ** ** *********
********** * * **********
I started writing a code but i'm not sure how for example on the first triangle to increment 1 "*" on each new line. Can someone help me on incrementing 1 "*" on each of the next 10 lines to get the triangle pattern? Than I should be able to get the next 3 triangles. Thanks for your help.
[code]
public class Triangle
{
public static void main( String args [] )
{
for ( int j = 1; j <= 10; j ++ )
{
for ( int i = 1; i <= 10; i ++)
System.out.print ( '*');
System.out.println();
}
}
}
Output:
**********
**********
**********
**********
**********
**********
**********
**********
**********
**********
Press any key to continue . . .