Average and Median
InterviewTime limit1sMemory limit128 MB
Read five natural numbers and print their average and median.
Problem
The average is the sum of the given numbers divided by how many numbers there are. The median is the value in the middle after the numbers are sorted in increasing order.
Given five natural numbers, write a program that prints their average and median.
Input
Five natural numbers are given, one per line, from the first line through the fifth line. Each number is a multiple of 10 and is less than 100.
Output
Print the average on the first line and the median on the second line. Both values are natural numbers.