How to make program (triangle pattern) in Java? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How to make program (triangle pattern) in Java?

For the output of the program: Enter Triangle Size : 5 * *** ***** ******* *********

10th Dec 2017, 5:07 AM
Kevin Wijaya
Kevin Wijaya - avatar
1 Antwort
+ 3
public class Program { public static void main(String[] args) { for(int i = 0; i<5; i++){ for(int j = 0; j<5-i; j++){ System.out.print(" "); } for(int k = 0; k<=i; k++){ System.out.print(" *"); } System.out.println(); } } }
10th Dec 2017, 5:26 AM
Shtorma
Shtorma - avatar