+ 1

What is looping? Can you explain with an example for "do..while" loop....

27th Apr 2017, 12:26 PM
Paavan Gupta
Paavan Gupta - avatar
5 Answers
+ 2
int age = 21; do { workFor1Year(); age++; } while(age < 65); retire();
27th Apr 2017, 1:13 PM
Igor B
Igor B - avatar
+ 2
is this correct . . "A loop statement allows us to execute a statement or group of statements multiple times and following is the general from of a loop statement in most of the programming languages: ... You can use one or more loop inside any another while, for or do..while loop."
27th Apr 2017, 1:27 PM
Paavan Gupta
Paavan Gupta - avatar
+ 1
looping is running or executing some statements again and again till a condition or test fails. do while is a exit control loop because the the condition or test is provided at the end of loop so first it runs the loop for 1st iteration and then condition is checked. do{ x=x+2;//statement to run in loop }while(x<5);//condition till the loop continues to run
27th Apr 2017, 1:43 PM
Saurav Jha
Saurav Jha - avatar
+ 1
Ok thanks to both of you
27th Apr 2017, 1:44 PM
Paavan Gupta
Paavan Gupta - avatar
0
yes u can use any number of loops inside any loop it is called nested looping
27th Apr 2017, 1:46 PM
Saurav Jha
Saurav Jha - avatar