Monday, August 4, 2014

How to print the given format in java

How to print the given format in java
       *
       * *
       * * *
       * * * *
       * * * * *
 Code for given format..
  public class Test
  {
  public static void main(String args[])
    {
      for(int i=0;i<5;i++)
       {
       for(int j=0;j<5;j++)
       {
          System.out.print("*");
       }
        System.out.println();
     }
  }
}

The first for loop is used to change the line
  the second loop is used to print the *

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...