[Solved]Write Code Event Handler Uses Loop Get Numbers User User Enters Negative Number Loop Stops Q37171681
Write code for an event handler that uses a Do loop to getnumbers from the user. If the user enters a negative number, theloop stops. How would you code this without adding a separate ifstatement inside the loop, and only check for the number beingnegative in the While condition?
After the loop ends, the code displays the average, max and minvalue.
in visual studio language
For the code to work, get the first entry before the loop,assign it to min, max and the total.
You can then use the Do While on the condition that the entry isnot negative. Inside the loop you must add up each entry the userprovides and count it and keep track of the min and max.
Note that average is calculated as the total divided by thenumber of entries. This line should be placed after the loop isdone.
You can not ask the end user for the number of entries theyhave.
Expert Answer
Answer to Write code for an event handler that uses a Do loop to get numbers from the user. If the user enters a negative number, … . . .
OR

