I need java code his output is a triangle like this : | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I need java code his output is a triangle like this :

I need java code his output is a triangle like this : * ** *** **** ***** ****** ******* ******** ********* **********

8th Jun 2018, 6:26 PM
ahmed kobi
ahmed kobi - avatar
5 Answers
+ 2
Use a nested loop. First loop will keep track of how many stars, and the second loop will print them.
8th Jun 2018, 6:31 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 2
can u creat for me this code ?
8th Jun 2018, 6:33 PM
ahmed kobi
ahmed kobi - avatar
+ 2
thanks bro
8th Jun 2018, 6:50 PM
ahmed kobi
ahmed kobi - avatar
+ 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 } } }
8th Jun 2018, 6:36 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
You're welcome bro! Wish you the best in your learning.
8th Jun 2018, 7:21 PM
Fata1 Err0r
Fata1 Err0r - avatar