Star Pattern Program in Java

Star Pattern Program in Java
 /*Java for loop example to print stars
nested for loops (for loop inside a for loop) to print stars*/

Following star pattern is printed
*
**
***
****
*****

public class StarPattern{
  public static void main(String[] args) {
    int row,Stars;

    for (row = 1; row <= 5; row++) {
      for(Stars = 1;Stars <= row;Stars++) {
        System.out.print("*");
      }
      System.out.println();
    }
  }
}
Copyright © C Program | Java | OpenGL Programming | Hadoop at Computaholics