Difference between while loop/entry control loop and do while loop/exit control loop

No comments

while loop/entry control  loop v/s do while loop/exit control loop :-



while loop/entry control  loop
do while loop/exit control loop
1 . It is entry control loop. First the condition is evaluated then the loop body is executed.
1 . It is exit control loop. First the loop body is executed then condition is evaluated.
2 . Body of loop may executed 0 or more times.
2. Body of loop may executed 1 or more times.
3 . Syntax:
         initialization;
           while(condition)
               {
                    body
                    increment/decrements;
               }
3 . Syntax:
         initialization;
           do
               {
                    body
                    increment/decrements;
               }    while(condition)
4 . A variable value is initialized at the beginning or before the loop and  is used  in the condition.
4 . A variable value is initialized before or inside the loop and used in  the condition.

No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀