Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Quries

Ads

 
 

Share on Google+Share on Google+

chandru
Quries
1 Answer(s)      6 years ago
Posted in : Java Beginners

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.

Ads
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);
        }
}

Ads









Related Tutorials/Questions & Answers:
sql quries
sql quries  i want basic sql quries please provide
Advertisements
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