Why is it important to test for invalid input for the initial sentinel value when using while loops?

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter5: Looping
Section: Chapter Questions
Problem 7RQ
icon
Related questions
Question

Why is it important to test for invalid input for the initial sentinel value when using while loops?

Expert Solution
Step 1

Sentinel value is an uncommon worth used to end a sentinel-controlled circle. In a sentinel-controlled circle, it is obscure how frequently the circle will repeat through the circle body. A sentinel esteem is picked chiefly from ill-conceived information and it guarantees that the circle will end in the event that it is given as info. An illustration of sentinel worth would be "- 1" for testing non-negative numbers.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer