do – while loop

The do – while loop statement allows you to execute code block in loop body atleast one time.

The syntax is:-

do{

statement 1;
statement 2;
statement 3;
……………..
statement n;

}while ( condition );

Example C program.

#include<stdio.h>
int main()
{

int  count = 0;

do{

/* Welcome to gyantoday.com is printed at least  one time
even though the while loop condition is false*/
printf(“Welcome to gyantoday.com\n”);

}while (count != 0);

return 0;

}

 

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.