#C11371. Calculate Average in Range
Calculate Average in Range
Calculate Average in Range
Given the lower bound \(L\) and the upper bound \(U\), and a list of floating point measurements, calculate the average of the measurements that lie within the range \([L, U]\) (inclusive). The result should be formatted to six decimal places. If no measurement exists within the range, output "No measurements in range".
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains two space-separated floating-point numbers, (L) and (U), representing the lower and upper bounds respectively.
- The second line contains an integer (N), which is the number of measurements.
- Each of the following (N) lines contains a single floating-point number representing a measurement.
outputFormat
If there is at least one measurement within the inclusive range ([L, U]), print the average of these measurements formatted to six decimal places. Otherwise, print the string "No measurements in range" on standard output (stdout).## sample
10.5 20.75
5
8.25
15.0
22.1
18.5
10.5
14.666667