Pattern-3

Home / Java Patterns / Pattern-3

Pattern-3


*

     **

     ***

     ****

     *****

Solution:  

public class leftTrianlge {

  public static void main(String[] args) { 

    // size of the triangle

    int size = 5;

    // loop to print the pattern

    for (int i = 0; i < size; i++) {

      // print column

      for (int j = 0; j <= i; j++) {

        System.out.print("*");

      }

      System.out.println();

    }

  }

}