Question
2Q) For a set of n real numbers , here are a number of basic statistics we would like to know about the distribution of
2Q)For a set of n real numbers , here are a number of basic statistics we would like to know about the distribution of these numbers:
. The minimum value m = min .
. The maximum value M = max .
. The average value.
. The standard deviation .
Write a program stats.c that calculates these values for a sequence of values it reads from stdin.
The input is provided as a sequence of n + 1 numbers, each on a separate line. The first number is n. The remaining n numbers are . Your program may assume that . For two bonus marks, your code should be able to handle any value of n, even values greater than 1000.
For any given input, your program should print the output
m = . . .
M = . . .
a = . . .
s = . . .
to stdout, where the ... are to be replaced with the values of m, M, a, and s. Each output value should be represented with 3 digits after the decimal point.
To generate some test data for your program, you can use the genseq program you created earlier. The invocation . /genseq
{ Xi ' . .. , Xn } { Xi ' . .. , Xn } { Xi ' . .. , Xn } , Xn n
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started