+ 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 Odpowiedź
+ 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