Question
Statistics (stat.c) Write a program that allows the user to enter a series of numbers and calculate the running average of these numbers as the
Statistics (stat.c) Write a program that allows the user to enter a series of numbers and calculate the running average of these numbers as the program executes, also keep track of the minimum and maximum value as the program runs. The program runs inside an infinite loop that is terminated when the number -999 is entered as the input choice. Print out statistics each time for the total(summation), average(mean), minimum number, and maximum number as the program runs. The different calculations should each be done in their own independent function separate from the main.
Implement these functions:
double mean(double sum, int n);
double min(double n, double min);
double max(double n, double max);
void print(double total, double avg, double min, double max);
THE PICTURE SHOWS THE OUTPUT:
Language in C...not C++
Please enter a value (-999 to quite) 1 total 1.000000 avg: 1.000000 minimum value: 1.000000 maximum value 1.000000 Please enter a value (-999 to quite) 2 total 3.000000 avg: 1.500000 minimum value: 1.000000 maximum value 2.000000 Please enter a value (-999 to quite) 4 total 7.000000 avg: 2.333333 minimum value 1.000000 maximum value 4.000000 Please enter a value (-999 to quite) -999 Final Statistics: total 7.000000 avg: 2.333333 minimum value: 1.000000 Maximum value: 4.000000Step 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