Mean, Median and Mode

108 views 7:10 am 0 Comments August 12, 2023

Given a list of integers, write a program to print the mean, median and mode.

Mean – The average value of all the numbers.

Median – The mid-point value in the sorted list.

Mode – The most common value in the list.

 

If multiple elements with same frequency are present, print all the values with same frequency in increasing order. Input

The input will be a single line containing space-separated integers. Output

The first line of output should contain the mean, round off the value to 2 decimal places.

The second line of output should contain the median, round off the value to 2 decimal places.

The third line of output should contain the mode.

Mean should always be a float value.

Median should be a float value when there are even number of elements, otherwise should be an integer value.

 

Tags: , , , , , , ,