বৃহস্পতিবার, ২৪ এপ্রিল, ২০১৪

Difference between do while loop and while loop


Difference between do while loop and while loop


do while loop:

Though the condition of the loop is false, it goes inside of the loop.  The do while loop executes the content of the loop once without checking the condition of the while.

while loop:

Whereas a while loop will check the condition first before executing the content.If the condition is false, it does not go inside of the loop;


1
do while loop
while loop
2

int  len;
do {
        printf(" length... ");
        scanf("%d", &len);
    } while(len<2);

int  len;

while(len<2){
        printf(" length... ");
        scanf("%d", &len);
         } 

কোন মন্তব্য নেই:

একটি মন্তব্য পোস্ট করুন