difference between while and do while
Answers
Answered by
2
the difference between the do while loop executes at least once because it checks for the loop condition while exiting
let's say a is 1
the code
do{
//something
}while(a==5)
will execute once but
while()a==5){
??something
}
will not
the loop condition for while fails at loop entry,but do while executes once ,then checks for loop condition,and then fails
let's say a is 1
the code
do{
//something
}while(a==5)
will execute once but
while()a==5){
??something
}
will not
the loop condition for while fails at loop entry,but do while executes once ,then checks for loop condition,and then fails
Lovingshruti:
Thanks for your answer
Similar questions