Do while loop

Program Description

The program shows an example using do...while loop

A do...while loop executes a set of instructions in a loop untill a given condition is satisfied. The program break out of he loop as soon as the condition fails.

do{

//do something

}while(condition is true)
;

Program
/**********************************
*    Do while loop
*
*	 code.cheraus.com
*
**********************************/


#include<stdio.h>

int main()
{
  int i=0;

  do{
      printf("%d\n",i);
      i++;
    }while(i<10);
   return 0;
}

Output
0
1
2
3
4
5
6
7
8
9

Comments
comments powered by Disqus