The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C do while loop

The do while loop evaluates the condition only after the execution of the statements in its body. The statements within the do-while loop executed at least once. A do while loop is also called as bottom tested loop.

do while loop Syntax

Let us see how neat a syntax of do while loop is

Syntax
do
{
statement 1;
statement n;
}
while(test expression);

C program - do while loop

The following example program will clearly explain the concept of do while loop

dowhile.c
#include <stdio.h>
int main()
{
do
{
printf("I will display once ");
}
while(2 > 10);
return 0;
}
  • I will display once

Note:

Although the test condition in the while loop may false for the very first time. The statements of do-while loop will be executed at least once.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report