C do-while Loop

  • In implementation when we need to repeat the statement block atleast one then for do-while loop.
  • In do-while loop past checking process will be occur. i.e. after execution of the statement block condition part will be executed.

Syntax:

do
{
statment1;
statment2;
statment3;
statment4;
}
while(condition);

Examples:
Print numbers from 1 to 10

void main()
{
int i;
i=1;
do
{
printf(“%d”,i);
++i;
}
while(i<=10); }

Powered by k2schools