Question: In C program Sum.c #include int main() { int sum = 0; int n; while (scanf(%d, &n) != EOF) { sum += n; } printf(%d
In C program

Sum.c
#includeint main() { int sum = 0; int n; while (scanf("%d", &n) != EOF) { sum += n; } printf("%d ", sum); return 0; }
(2 Points). Copy your sum.c file into a new file, avg.c. Modify the algorithm and then the code to print the average of the input instead of the sum. Here's an example run: Enter an integer value: 10 Enter an integer value: 20 Enter an integer value: 30 Enter an integer value: [control-D] The average of 3 input values is 20.000000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
