C program to study 'do-while' loop
How do while loop is working in c program with syntax and example
by Krishna viswambharan
Posted on 21 Aug 2017 Category: C
Edited on 25 Aug 2017
Familiarization of 'do-while' loop
In the last sections we have seen that how to use the ‘for loop’ and ‘while loop’. One of the other important loop in C programming is ‘do..while loop’. Let us see how it works.
The syntax is given as follows :-
do-while loop is similar to while loop, but there is one difference between these two loops. do-while runs at least one even if the test condition is false at first place.
Notice that the condition test is given at the bottom of the loop. So we can say that loop will run at least once even if the condition is false.
When the condition is true , the control goes back to ‘do’
printf(“\n %d”,count); // print the value in the variable 'count' even though the condition is false.
C program to study while loop