+ 1
I need java code his output is a triangle like this :
I need java code his output is a triangle like this : * ** *** **** ***** ****** ******* ******** ********* **********
5 Answers
+ 2
Use a nested loop. First loop will keep track of how many stars, and the second loop will print them.
+ 2
can u creat for me this code ?
+ 2
thanks bro
+ 1
https://code.sololearn.com/cCE8S9Q7N20V/#java
public class Program
{
public static void main(String[] args) {
for(int i = 0; i < 10; ++i){
for(int j = 0; j <= i; ++j){
System.out.print("*"); // print stars
}
System.out.println(); // take us to next line
}
}
}
0
You're welcome bro! Wish you the best in your learning.