Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include double findAvg(int [], int); /* fctn ptype (arrayName, arraySize) */ double stdDev(int [], int, double); /* fctn ptype (arrayName, arraySize, average */ void

#include

#include

double findAvg(int [], int); /* fctn ptype (arrayName, arraySize) */

double stdDev(int [], int, double); /* fctn ptype (arrayName, arraySize, average */

void entvals(int[], int); /* arrayName, arraySize */

int main()

{ #define NUMELS 10 int values[NUMELS] ;

double average, stddev;

entvals(values, NUMELS);

Using C

Write a main program that prompts the user to enter a fixed number of integer data items using the keyboard and stores them in an array.

a. The program should then display all entered array elements with each element name and value on a separate line.

b. The program should then call 2 functions:

i. The first function returns the average of the values in the data array

ii. The second function uses the average above to calculate the standard deviation of the array values. Note that the user data acquisition task can also be written as a function.

2) Average calculation:

a. Use the usual sum of all elements divided by the number of elements to calculate the average

3) Standard Deviation calculation:

a. Subtract the calculated average from each array value. The result is a new set of array values, each called a deviation.

b. Square each deviation.

c. Take the average of the squared deviations, as in step 2.

d. Take the square root of the result of step c (above). This is the Standard Deviation.

e. Use double precision for calculation variables, and integers for indices.

4) Display the Average and Standard Deviation

5) Loop the program continually so new arrays can be entered.

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions