Question: This code calculates the average of positive numbers, but it is missing the condition for the loop on line 1 4 . Let s use

This code calculates the average of positive numbers, but it is missing the condition for the loop on line 14. Lets use -1 as the sentinel value. Add the condition to the while loop to run while the user does not input -1. What would happen if you forgot step 3(change the loop variable - get a new input)? Try commenting out line 19 with // to see what happens (note there is a stop button at the top!).

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!