Question: Specification Modify the program above, further simplifying communications between functions by using global variables. Implementation download program runningAveGlobal.c. Complete the main() function. download program function.c.


Specification Modify the program above, further simplifying communications between functions by using global variables. Implementation download program runningAveGlobal.c. Complete the main() function. download program function.c. Complete function void r_avg(), which computes and displays the running average. Notice that this function takes no arguments. define all global variables in function.c Sample Inputs/Outputs: red 307 % gcc-Wall runningAveLocal.c red 308 % a.out Enter number (-1 to quit): 10 running average is 10 / 1 = 10.000 Enter number (-1 to quit): 20 running average is 30 / 2 = 15.000 Enter number (-1 to quit): 33 running average is 63 / 3 = 21.000 Enter number (-1 to quit): 47 running average is 110 / 4 = 27.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 -1 Enter number (-1 to quit): red 309 % int main(int argc, char *argv[]) { int input; printf("Enter number (-1 to quit): "); scanf("%d", &input); while(input != -1){ r_avg(); // read again } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
