+ 1
How to make program (triangle pattern) in Java?
For the output of the program: Enter Triangle Size : 5 * *** ***** ******* *********
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();
}
}
}