Do while loops Do while loops are special kind of loops that are used to execute statements repeatedly in some programming languages including C. The do while loop is quite similar to the while loop but the main special thing about Do While loops are that they evaluate conditions at the bottom of the loop after executing the loop body. It follows the following format:- Code: do { Code to execute; } while(condition); The Working First the program blindly executes the ‘Code’ specified between the braces (‘{’ and ‘}’) Then after executing it checks if the condition evaluates to true. If it is true the loop body is executed This process of repeatedly execution continues until the condition evaluates to false. That’s much of a theory there now let’s get started and Construct some do while loops Constructing do while loops Let’s start by converting some English statements to pseudo-code statements using do while loops. 1. Mother says to the Robot, “You can mop the floor any number of times if you wish but at least 1 time is compulsory.” Code: do { mopTheFloor(); } while(want == true); 2 . Teacher says to the Student, “You can do any number of questions as you want but you have to do at least 20 of them.” Code: do { do20Questions(); } while(want == true); Now that we have a basic understanding of how to construct do while loops now let’s move on to how we can use these statements to create simple real world C programs. Using do while loops Now let’s create a simple C program which would basically printout “hello world” at least one time and will ask if the user wants to display it more times. Code: #include<stdio.h> int main() { char option; do { printf("Hello World"); printf("\nDo you want to Continue (Y/N) : "); scanf("%c",&option); } while(option != 'N'); return(0); } Explanation:- First we declare a ‘char’ variable named option. ‘option’ is used to input the answer of the user. In the loop body , We simply printout hello world and ask the user if he/she wants to continue. Then we input their answer using scanf() statement. Then finally we check we check if the user has input a ‘N’ (i.e NO) , and if it is false the loop continues. Output:- Code: Hello World Do you want to Continue (Y/N) : Y Hello World Do you want to Continue (Y/N) : Y Hello World Do you want to Continue (Y/N) : N That’s all for this tutorial stay tuned for more.