0
37kviews
Explain difference between while and do-while loop.
1 Answer
| written 9.3 years ago by |
| While loop | Do..While Loop |
|---|---|
| Syntax:,while(condition),{ | Syntax:,do,{ |
| } | }while(condition); |
| Semicolon (;) is not used | Semicolon (;) is used |
| Condition is checked first. | Condition is checked later. |
| Since condition is checked first, statements may or may not get executed. | Since condition is checked later, the body statements will execute at least once. |
| The main feature of the while loop is,its an entry controlled loop. | The main feature of the do while loops is it is an exit controlled loop |
![]() |
![]() |
![]() |
![]() |
| from 1 to 50. | - |