Program to print the given triangular pattern


public class Pattern {
public static void main(String[] args) {
int i,j,k,l=4;
for(i=0;i<=l;i++){
for(j=0;j<l-i;j++){
System.out.print(” “);
}
for(k=j-1;k<l+(i);k++){
System.out.print(“*”);
}

System.out.println();
}
}

}

Output:
    *
   ***
  *****
 *******
*********

Leave a Reply