Answered step by step
Verified Expert Solution
Question
1 Approved Answer
5.1 Specification Complete the ANSI-C program runningAveLocal.c, which should read integers from the standard input, and computes the running (current) average of the input integers.
5.1 Specification Complete the ANSI-C program runningAveLocal.c, which should read integers from the standard input, and computes the running (current) average of the input integers. The program terminates when a-1 is entered. Observe how the code display the running average with 3 decimal points " how a pre-processing macro MY PRINT (x,y, z) printf .is defined, which displays the result as shown in the sample outputs. (Thus, the program use MY_ PRINTF rather than printf () to display averages.) we will cover pre-processing next week. 5.2 Implementation define a function double runningAverage (int currentSum, int inputCount) which, given the current sum currentSum and the number of input inputCount, computes and returns the running average in double. The current sunm and input count are maintained in main 5.3 Sample Inputs/Outputs: red 307 gcc-Hall ru eLocal.c red 308 % .out enter number (-1 to quit) 10 running average is 10110.000 enter number (-1 to quit) 20 running average is 30 2 15.000 enter number (-1 to quit) 33 running average is 63 321.000 enter number (1 to quit) 47 running average is 110427.500 enter number (-1 to quit) 51 running average is 161 5 32.200 enter number (-1 to quit) 63 running average is 224 6 37.333 enter number (-1 to quit) -1 red 309 Assume all the inputs are valid
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