Question: #include int foo(double sum) { int total = 0; int i = 0; sum = 0; scanf(%d, &i); while(i != 0) { values++; sum +=
#include
int foo(double sum) { int total = 0; int i = 0; sum = 0; scanf("%d", &i); while(i != 0) { values++; sum += i; scanf("%d", &i); } return total; }
int main(]) { double sum = 0; int total; int avg = 0; total = foo(sum) avg = (sum/total); printf("Avg: %d ", avg); return 0; }
C Programming Language. Is there a way to get the value of sum returned back to main without changing the parameters and return value of foo? "*sum" in the parameter is not allowed or altering "return total". For example if the input was 2,2,3,3,0 then the returned sum value should = 10. Thanks
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
