C Do While Loop

Last Updated Nov 20, 2015, 07:00:14 PM





Do while loop in c works almost similar to while loop but the only difference is it checks for the condition in the bottom or at the end of the loop

Do while loop executes a block of code at least once. The result of boolean condition decides whether or not the exectution should repeat

c do while loop

Syntax

  • The do while loop in C programming, consists of a process symbol and a condition first
  • Initially, the code we write within the blok is executed and then only the condition is evaluated.
  • This repeats until the condition becomes FALSE.
Example Try It Now

Difference between While loop and Do while loop in C

The do while loop executes the content of the loop once before checking the condition of the while. Whereas a while loop will check the condition first before executing the content.



Why use a “do while” loop? - StackOverFlow

Other Loop Topics you might want to learn

for loop in C

while loop in C

nested loops in C