do while Loop in C

Notes:

do while Loop in C Programming Language:

do while loop: Exit control loop
- Computer executes body of the do while loop at least once. And then it repeatedly executes the body of the do while loop as long as the given conditional expression evaluates to true.

Syntax:
initialization;
do
{
statement(s);
increment/decrement;
} while(conditional expression); // Condition is checked at the end of the loop

Ex: Program to display Hello World 5 times using do while loop

int i=0;
do
{
printf(“Hello World\n”);
i++;
}while(i<5);

Note: When we want to execute set of statements at least once, whether the given conditional expression evaluates to true or false does not matter, then we use do while loop.