+ 1

Do While

When is do-while usually used?

29th May 2018, 10:45 PM
ADESH RAI
ADESH RAI - avatar
3 odpowiedzi
+ 8
do-while is an EXIT control loop. It first executes the statement for one time and then checks the given condition. It is mostly used to make our program user-friendly that is for asking the user like "do you want to continue (y/n) : ". If the user enters y it repeats again. and if the user enters n it gets out of loop as you have set the condition as while(ch==y);
29th May 2018, 10:56 PM
Mohammad Amir Aqeel
Mohammad Amir Aqeel - avatar
+ 4
Hello Namnu Namnu! Check out the answers in these discussions. They should help. I was gonna answer but then it occured to me that answers are already out there somewhere. The second link contains links to more discussions. https://www.sololearn.com/Discuss/1233953/?ref=app https://www.sololearn.com/Discuss/840631/?ref=app
29th May 2018, 10:50 PM
cyk
cyk - avatar
+ 2
not technical: you know the end point of loop where you want to stop.
30th May 2018, 4:07 AM
Nitish kumar jha
Nitish kumar jha - avatar