Quries

Quries

a JAVA program to create an array of size 10 (Integer Values) by taking input from BufferReader and find out the average value of array elements from that array.

View Answers

August 4, 2011 at 11:01 AM

import java.io.*;
class  ArrayExample{
    public static void main(String[] args)throws Exception{
        int sum=0;

        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter Array Elements: ");
        int array[]=new int[10];
        for(int i=0;i<array.length;i++){
            array[i]=Integer.parseInt(br.readLine());
        sum+=array[i];
        }
        System.out.println("Sum Of Array Elements is: "+sum);
        System.out.println("Average of Array Elements is: "+(double)sum/array.length);
        }
}









Related Tutorials/Questions & Answers:
sql quries
sql quries  i want basic sql quries please provide
Quries
Advertisements
Quries
Quries
Quries
Quries
Quries
Quries
Java Quries
uploading image in the form
they logged into the screen. Im using Orcale database(sql quries to check
CHECK WHICH NO IS GREATER IN 4 NO'S
chaudhary(+919261377137) if you want to ask any quries then contact me or email

Ads