Need help to write this program in java?
-hi
-I recently started learning java language. Yesterday our sir has given us assignment in which there is a program like write java program to show using star and "-" is space
- ----- *
- ----**
- ---***
- --****
- *****
- and
---------*
--------***
-------*****
------*******
-----*********
------*******
-------*****
--------***
---------*
Re: Need help to write this program in java?
I will write a java program for CROSS STARS pattern using NESTED LOOP, which you can refer below:
for (int i = 1; i < 10; i++) {
for (int j = 1; j < 10; j++) {
if ( i == j || ( i+j == 10 )) {
System.out.printf("*");
} else {
System.out.printf("");
}
}
System.out.println();
}
replace 10 with the user input for number of stars :)