When you are certain of the number of times the statements must be run, you should design a state-controlled loop.
When a condition is not satisfied, a "While" loop is used to repeat a certain piece of code an undetermined number of times. For instance, if we want to ask a user for a number between 1 and 10, but we don't know how often they might enter a greater number, we keep asking "while the value is not between 1 and 10."
We use a for loop when we (or the computer) know exactly how many times to run a portion of code (like shuffling a deck of cards). While loops are used to repeatedly run a block of code up until a predetermined condition is satisfied.
To know more about loop click here:
https://brainly.com/question/25955539
#SPJ4