while loop
The syntax of the while loop is:
while (testExpression)
{
// statements inside the body of the loop
}
How while loop works?
The while loop evaluates the test expression inside the parenthesis ().
If the test expression is true, statements inside the body of while loop are executed. Then, the test expression is evaluated again.
The process goes on until the test expression is evaluated to false.
If the test expression is false, the loop terminates (ends).
Print numbers from 1 to 5Output
1
2
3
4
5
Put the parts in order to form a sentence. When you think your answer is correct, click on "Check" to check your answer. If you get stuck, click on "Hint" to find out the next correct part.