The syntax of the do while loop is:
Do
{
statement;
} while (expression);
/* Program to illustrate the do while loop*/
#include < stdio.h > //include stdio.h file to your program
void main() // start of your program
{
char inchar; // declaration of the character
do // start of the do loop
{
printf(“Input Y or N”); //message for the user
scanf(“%c”, &inchar); // read and store the character
} while(inchar!=’y’ && inchar != ‘n’); //while loop ends
if(inchar==’y’) // checks whther entered character is y
printf(“you pressed y\n”); // message for the user
else
printf(“You pressed n\n”); } //end of for loop