Do While Loop in C programming will execute the code block once, before checking if the condition is true, and repeat a specific block of code until the condition is met.
do
{
this;
and this;
and this;
and this;
}
while(this condition is true);
#include<stdio.h>
#include<conio.h>
void main()
{
int a = 1;
do //doing then Statement.
{
printf("%d \n", a);
a++; //adding 1 to 'a'.
}
while(a <= 10); //loop from 0 to 10.
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int val;
do //executing process.
{
printf("Please Enter Password: ");
scanf("%d", &val); //user enter value storing in 'val'.
}
while(val != 54265); //loop stop when 'val' value Equal to 54265.
printf("Password Correct!");
getch();
}