PDA

Click to See Complete Forum and Search --> : [RESOLVED] creating a pattern


dim_kevin_as_human
Apr 30th, 2009, 05:09 PM
using for loops in java, how do i create this pattern in the output window?
you an only use System.out.print('*') and System.out.println()

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

kfcSmitty
Apr 30th, 2009, 07:24 PM
I don't have a compiler available right now, but something like this should work.
I would really suggest you attempt these kind of things before posting here. You haven't shown any code and it is really just simple math to figure it out.

for(int i = 1; i <= 10;i++){
for(int x = 1; x <=i;x++){
System.out.print("*");
}
System.out.println();
}