Ad Code

Responsive Advertisement

do while loop.


1) Do while loop :

Syntex :
       do
         {
                // progrma(task)
         }while( condition );



 it diffrent from other loop beacouce it check the condition in last and do the task without check the condition.

 If the condition is false than it one time execute the code because it first Do the task and than check the condition.

And in last while(condition) check the condition if the condition is true than it DO the task again . If the condition is false than it not Do the task but, one time execute the code.an dit last used the semicolon.

Example :

#include<stdio.h>
 void main()
 {
         int a=2;
      do
       {
             printf(“hello”);
       }while(a<3);
a++;

}
out put:  hello


❮ Previous                                                      Next ❯

Post a Comment

0 Comments