|
What would happen if the the user entered a negative number? A good answer might be:Since negative numbers do not have a real square root, the loop would be unable to compute it and would run forever. | |
Checking the User InputThere are several ways in which defective user input could be handled. One way is to check the N that the user entered. If it is OK, execute the loop. Otherwise, write an error message to the screen and end the program. Here is the revised program, with some blanks:
| |
QUESTION 18:Fill in the blanks so that the program checks that the user input is positive. Click Here after you have answered the question |