Aug 22

Syntax:

do

{

.

.

.

}while(this condition is true);

The only difference between while and do-while is that do-while would execute its statements at least once,even if the condition fails for the first time.

Example

main()

{

do

{

printf(”Hello”);

}while(4<1)

}

printf  would be executed once, since first  the body of the loop is executed and then condition is tested.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • Twitter

written by Shweta