It is also called as post tested loop. It is used when it is necessary to execute the loop at least one time. Syntax:
do {
Loop body
} while (Expression);
Example:
int main(){
int num,i=0;
do{
printf(“To enter press 1\n”);
printf(“To exit press 2”);
scanf(“%d”,&num);
++i;
switch(num){
case 1:printf(“You are welcome\n”);break;
default : exit(0);
}
}
while(i<=10);
return 0;
}
Output: 3 3 4 4