How to write a program with triangle star pattern.
*
* *
* * *
public class triangle {
public static void main(String[] args) {
for(int i=1;i<=3;i++) {
for(int j=3;j>=i; j--) {
System.out.print(" ");
}
for(int k=1;k<=i; k++) {
System.out.print("* ");
}
System.out.print("\n");
}
}
}