Posts

Showing posts with the label mean

mathajax

Java program Sum and Average

The program is to finds sum and average or mean value from given N integers value . The input N integers are read from user via keyboard and used to calculate sum and average values. Example - given inputs N=5 and integers [2 5 8 12 6] sum = 2 + 5 + 8 + 12 + 6 sum = 33 average or mean = 33/5 = 6.6 pseudocode - Sum and Average Read N integers and store it into a array variable "intary" set sum=0,average=0 For i=0 to N-1   sum = sum + intary[i] End For average= sum / N print sum,average Java program - Sum and Average The Java program reads N input integers from user through BufferedReader connected with keyboard and calculate sum and average value of these inputs and returns sum and average value as results of the inputs. import java.io.BufferedReader; import java.io.IOException; import ja...