Question: Modify the code to allow the user to enter any number of positive integers and calculate the average. In other words, the user could enter

Modify the code to allow the user to enter any number of positive integers and calculate the average. In other words, the user could enter any number of positive integers. (Hint: you can prompt the user for how many they want to enter. Or you can use sentinel value to trigger when the user has completed entering values). Prepare a new test table with at least 3 distinct test cases listing input and expected output for the code you created. Support your experimentation with screen captures of executing the new code.
This is the code in the picture.  Modify the code to allow the user to enter any number

Styles #include int main 0 /* variable definition: int count, value, sum double avg / Initialize / count 0 sum = 0; avg = 0.0; // Loop through to input values while (count 10) printf ("Enter a positive scanf("%d", &value ) ; if (value) t Integerln"); sum sum+ value count count + 1i else t printt ("Value must be positiveln"): / Calculate avg. Need to type cast since two integers will yield an integer avg(double) sum/count: printti" return 0 ave rage is %lf " , avg )

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!