When re-prompting on input failure, a loop should be used.
A)
Counter-controlled loop
The loops in which a number of the iteration are definite or known to the user before executing the loop. The counter is a control variable that is initialized before loop starts and controls the loop. For example, input exactly 5 integers using a while loop.
End-of-file controlled
It means data will be kept on processing until and unless there is no data in the file or the file is empty or reaches the end of the file.
Sentinel controlled
The number of iterations is in-definite and data will be kept on processing unless the user entered a special value which indicates that the loop must stop. For example, input certain integers until a special value selected by the user which is an illegal value has been entered.
The correct option is c. Sentinel controlled
Step by step
Solved in 2 steps