CodesJava

Easy learning with example program codes

C do while loop


C Do While Loop is a loop statement which is used to execute a block of code continuously as long as the condition of the loop is true, and stops only when the condition fails like other loop statements.

The unique feature of Do While loop is that it is used to execute a block of code at least once and then to repeat the actions as long as the specified condition is true.

 

Syntax:

do

{

    code to be executed;

}

while (condition);

 

Example 1: When the While condition is true

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

Output

12345678910

Example 2: When the While condition is false

void main()
{
int i = 11;
 
do
{
printf ("%d", i);
i++;
}
while (i <= 10);
}

Output

11
Posted in C   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki