Do while loop: Post-tested loop

Do While Loop Post Tested Loop Sourav Purkait


Do while loop is a post – tested loop. It is similar to while loop expect it executes its body at least once  weather the condition is true or false. The do while loop terminates when the text expression is evaluated to be zero.




    // statement;


while (condition );

Flow chart:



int main ()


int i=1;      



      printf(“%d  “,i);    




  return 0;  


Output: 1 2 3 4 5 6 7 8 9 10


The do-while loop is mainly used in the case where we need to execute the loop at least once. The do-while loop is mostly used in menu-driven programs where the termination condition depends upon the end user.


Disclaimer: The author(s) of this blog are solely responsible for the content posted. The blog platform serves as a medium for their expression, and the platform administrators assume no liability for the accuracy or legality of the content.
Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!