While Loop Statement
A while loop
statement repeatedly executes a target statement as long as a given condition
is true.
Syntax:
While (Condition){
Statements(s);
}
Here, statement(s) may
be a single statement or a block of statements. The condition may be
any expression, and true is any non-zero value. The loop iterates while the
condition is true.
When the
condition becomes false, program control passes to the line immediately
following the loop.
Flow Diagram
|