do-while Statement :
The do-while statement is an exit-controlled repetition structure. In this type
of loop, the loop body is executed first, and the condition is evaluated after the
execution of the loop body. As a result, the statements inside the loop are
executed at least once, regardless of the condition.
The do-while statement is an exit-controlled repetition structure. In this type
of loop, the loop body is executed first, and the condition is evaluated after the
execution of the loop body. As a result, the statements inside the loop are
executed at least once, regardless of the condition.
SYNTAX:
do
{
statements;
}
while (condition);
EXAMPLE:
#include<stdio.h>
int x = 1;
int main(){
do{
printf("hi\n");
x++;
}while(x<4);
return 0;
}
Output:
hi
hi
hi