Friday, 29 June 2012

Use Of Scanner Class Function In JAVA


import java.util.Scanner;


public class Ar
{
   public static void main(String arg[])
 {
      int[] n=new int[10];
Scanner in=new Scanner(System.in);
System.out.println("Enter the elements : ");
      int i=0;

for(i=0;i<10;i++)
{
System.out.print("Enter the element a[ : "+ i +"] = ");
n[i]=in.nextInt();
}
for(i=0;i<10;i++)
{
System.out.println("elements are  a[ : "+ i +"] = "+n[i]);

}


   
 }
}

No comments:

Post a Comment