C do-while loop is very similar to the while loops, but it always executes the code block at least once and as long as the condition remains true. This is an exit-controlled loop.

The basic format of the do while loop statement is:


}while( condition );

Figure - Flowchart of the do while loop:

Example of a C Program to Demonstrate do while loop

int main ()
   /* local variable Initialization */
   int n = 1,times=5;

   /* do loops execution */
       printf("C do while loops: %d\n", n);
       n = n + 1;
   }while( n <= times );
   return 0;
Program Output:

C do while loops - Video Tutorial

Please watch this tutorial to understand "C do while loops" in more depth.