Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed , here are a number of basic statistics we would like to know about the distribution of these numbers:

. The minimum value m = min image text in transcribed .

. The maximum value M = max image text in transcribed .

. The average valueimage text in transcribed.

. The standard deviation image text in transcribed.

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 image text in transcribed. Your program may assume that image text in transcribed. 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 <> generates a sequence of n random numbers and prints n followed by these n random numbers to stdout. Using . /genseq > seq.txt<>, you can save this output in a file seq.txt. You can use this as the test input for your stats program by running . /stats . Add your file stats.c to SVN and commit it.

{ Xi ' . .. , Xn } { Xi ' . .. , Xn } { Xi ' . .. , Xn } , Xn n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

More Books

Students also viewed these Databases questions