DWQA Ask QuestionCategory: JavaJava_Q: Arithmetic Mean, Median, Mode and Standard Deviation using Array
admin Staff asked 7 years ago

Write a Java program to answer about the statistical information such as arithmetic mean, median, mode, and standard deviation of an integer data set. The data points are input by the user from keyboard.

1 Answers
admin Staff answered 7 years ago

Posting Half of the code. Complete rest.

Start your code here
//Arithmetic Mean, Median, Mode and Standard Deviation using Array
public static void find_mean_median_mode_deviation(){

int[] arr = new int[5];
float temp1=0;
float average;
Scanner in = new Scanner(System.in);

System.out.println("Enter 5 values");
for(int i=0;i<=4;i++){
int temp = in.nextInt();
arr[i]=temp;
}

//find average
for(int i=0;i<=4;i++){
temp1 = arr[i] + temp1;
}

average = temp1/5;

System.out.println(average);


}