Search This Blog

Monday, 27 January 2014

simple program for array

/* Entry of 5 integer values using the concept of array*/

package array;
import java.io.*;
class ArrayClass2
{
   public static void main(String[] args) throws IOException
   {
       int[] ar=new int[5];
       int i;
       InputStreamReader inp=new InputStreamReader(System.in);
       BufferedReader br=new BufferedReader(inp);
       System.out.println("Enter five integer values : ");
       for(i=0;i<5;i++)
       {
          ar[i]=Integer.parseInt(br.readLine()); 
       }
       System.out.println(" five integer values are : ");
       for(i=0;i<5;i++)
       {
          System.out.print(ar[i]+" ");
       }
   }
}

output

No comments:

Popular Posts