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

In C program Sum.c #include int main() { int sum = 0;

Sum.c

#include  int 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!