* Site News

IT Acumens Proudly Presents "Gin Gly": Sms Backup / Contacts Backup / Sms Grouping Website Used by Members 83,375 - SMS Backed up 5,93,267 - Contacts Stored  28,096. For 3 Years and 3 Months !! Helping everyone Successfully !!

Author Topic: Unconditional Statements-Do while Loop  (Read 1589 times)

thiruvasagamani

  • Old Members
  • Hero Member
  • *
  • Posts: 6887
    • View Profile
Unconditional Statements-Do while Loop
« on: September 22, 2008, 10:48:17 am »
Do-While Loop:

Syntax:

initialisation;
do
{
stmt 1;
stmt 2;
......
......
stmt m;
increment/decrement;
}
while(condition);
stmt n;

In following figure init means intialization,cond means condition,inc/dec means increment/decrement,st means statements




Rules for do-while loop:

Statements in do-while are executed repeatedly executed as long as condition is true.The moment condition is false,control goes out of do-while loop and statements outside the loop are executed.

It is post tested loop or exit tested loop that is condition si tested at the end of loop.Hence do-while loop is executed at least once.There is semicolon(;) after condition, it indicates that end of do-while loop.


NOTE:
Use for loop,while loop,do-while loop to execute a group of statements repeatedly until condition is false


Thiruvasakamani Karnan


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
313 Views
Last post September 30, 2008, 04:10:03 pm
by thiruvasagamani