+ 3

What is t h e difference between while and do- while loop

19th Oct 2017, 3:22 AM
Saransh Maurya
Saransh Maurya - avatar
9 odpowiedzi
+ 7
Bjarne Stroutstrup.
19th Oct 2017, 6:17 AM
Lakshay
Lakshay - avatar
+ 5
do{ Statement; }while(condition); In this firstly loop gets started, then it checks the condition and now if it is not fulfilled, the loop terminates. So, do while loop must be executed atleast once even if the condition is not true. while(condition){ Statement; } It firsts check for the condition first and if it is fulfilled only then the loop will be executed.
19th Oct 2017, 3:45 AM
Lakshay
Lakshay - avatar
+ 4
Thanks for answer
19th Oct 2017, 3:53 AM
Saransh Maurya
Saransh Maurya - avatar
+ 3
while is entry controlled loop...whereas do while is exit controlled
19th Oct 2017, 4:37 PM
Thriveni
Thriveni - avatar
+ 2
Please tell me i dont know....
19th Oct 2017, 3:23 AM
Saransh Maurya
Saransh Maurya - avatar
+ 2
1. First check the condition, and if it returns true - execute the code in the block. while (some condition) { some code } It means, that the code in the block will never be executed, if the condition is false. 2. First execute the code in the do-while block, then check the condition. do { some code } while (some condition); Means, that the code will be executed at least once, even, if the condition is false.
19th Oct 2017, 4:19 AM
Boris Batinkov
Boris Batinkov - avatar
+ 2
WHO IS THE FOUNDER OF C++??
19th Oct 2017, 5:00 AM
Saransh Maurya
Saransh Maurya - avatar