The syntax for while loops in C is this:
while ( condition ) { ... ... <-- statements in the "body" of the loop. ... }
When the computer reaches a while statement in C, it goes through the following steps.
In other words, the computer executes the body of the while loop over and over until the condition becomes false. When the condition is false, the loop is over and the computer skips forward to the next statement.
We will now look at three different applications of while loops.