Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


chandru
Quries
1 Answer(s)      3 years and 5 months 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.


Advertisement
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
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
 

 

 

DMCA.com