Home | Computer Science

<
DO-WHILE LOOP

Defination

The do while loop checks the condition at the end of the loop.


DO-WHILE LOOP Syntax of for do while loop is
do {
// code block to be executed
}
while (condition);

NOTE
Do not forget to increase the variable used in the condition, otherwise the loop will never end!
Program
INPUT

#include <stdio.h> main() { int i = 0; do { printf("%d\n", i); i++; } while (i < 5); getch(); }

OUTPUT