Nested ForLoop Example in Java


Here is the simple program for printing basic example using Nested For Loop in Java.

Source Code

import java.io.*;
import java.util.Scanner;
class fo
{// Tutor Joes Computer Education
  public static void main(String args[])
  {
  /*
    *
    **
    ***
    ****
    *****
  */
   int i,j;
   for(i=0;i<5;i++)  //0<5 1<5 2<5
   {
    for(j=0;j<=i;j++)//0<=2
    {
      System.out.print("*");
    }
    System.out.println("");
   }
  }
}
To download raw file Click Here

Output

*
**
***
****
*****


Learn All in Tamil © Designed & Developed By Tutor Joes