- While loop evaluates the conditions inside the brackets.
- If the condition returns true, the statements inside the while loop body will be executed.
- Condition inside the while loop is executed once again.
- This process goes on until the condition in the while loop becomes false.
- Once the condition is false, while loop terminates.

Syntax of While loop
[pastacode lang=”c” manual=”while%20(testExpression)%20%7B%0A%20%20%2F%2F%20the%20body%20of%20the%20loop%20%0A%7D%0A” message=”” highlight=”” provider=”manual”/]Sample Code
[pastacode lang=”c” manual=”%2F%2F%20Print%20numbers%20from%201%20to%205%0A%0A%23include%20%3Cstdio.h%3E%0Aint%20main()%20%7B%0A%20%20int%20i%20%3D%201%3B%0A%20%20%20%20%0A%20%20while%20(i%20%3C%3D%205)%20%7B%0A%20%20%20%20printf(%22%25d%5Cn%22%2C%20i)%3B%0A%20%20%20%20%2B%2Bi%3B%0A%20%20%7D%0A%0A%20%20return%200%3B%0A%7D” message=”” highlight=”” provider=”manual”/]Output
[pastacode lang=”c” manual=”1%0A2%0A3%0A4%0A5″ message=”” highlight=”” provider=”manual”/]
