Search This Blog

Sunday, 13 October 2013

Print Numbers By for loop

import java.util.*;
class forloop
{
    public static void main(String args[])
    {
       Scanner in=new Scanner(System.in);
       int n;
       System.out.println("Enter the value:");
       n=in.nextInt();
       System.out.println();
       for(int i=0;i<n;i++)
       {
          System.out.print(i);
        }
    }
}


output 

 

No comments:

Popular Posts