Write a C program that does exactly the same calculations and report as project 3, but this time use functions.
Specification
Use at least five functions to do meaningful things. “Main” should consist primarily of function calls.
Remember, a function should have one well defined purpose. For example: get a valid number from the user, calculate the mean, display the table, etc.
Follow the format for C functions described in class. Function implementations should go after “main”. Prototypes must go before “main”.
Do not use any global variables.
Remember that arrays are passed by “reference” (address).
The user will enter up to a maximum of twenty numbers (type double).
They must enter a -1 as a sentinel value to signal no more inputs.
Negative numbers will be considered invalid for this program.
If the user enters a negative value other than (-1), display an error message.
(have the user re-enter the value)
Do not read more than twenty valid numbers.
Should the user enter twenty valid numbers, simply stop asking for more numbers.
Display the following information:
Each number entered, preceded by its array index.
The count of the valid numbers.
The sum of the valid numbers.
The mean (average) of the valid numbers.
The difference between each number and the mean.
The square of each of those differences.
The sum and average of those squares.
The square root of that average (known as the standard deviation).
(math.h has a function named “sqrt”)
Sample Run
Enter up to 20 numbers - (negative one to stop).
16
12
6
-18.5
Sorry, negative values are invalid!
8
2.5
12
14
-1
Index Number Difference Difference2
----------------------------------------------
0 16.000 5.929 35.148
1 12.000 1.929 3.719
2 6.000 -4.071 16.577
3 8.000 -2.071 4.291
4 2.500 -7.571 57.327
5 12.000 1.929 3.719
6 14.000 3.929 15.434
---------------------------------------------
Count = 7
Sum = 70.500000
Mean = 10.071429
Sum of squares = 136.214286
Avg of squares = 19.459184
StdDev = 4.411256
---------------------------------------------
So if there is anyone who's great at C and bored...maybe wanting to help me with some of this, please pm, or post here. Im willing to part with whatever fg I have.