Difference Between Entry Control Loop and Exit Control Loop

Difference Between Entry Control Loop and Exit Control Loop

Comparison between Entry Control Loop and Exit Control Loop

The Key Difference Between Entry Control and Exit Control Loop is that in Entry Control Loop the test condition is checked first and if that condition is true then the block of the statement will be executed, While in Exit control loop first executes the body of the loop and checks condition at last.

Loops are the technique to repeat statements until a given condition is true. The c programming language has three types of loops –

  1. while loop,
  2. do-while loop
  3. for loop.

These loops controlled either at the Entry level or at the Exit level hence loops can be controlled in these two ways.

Comparison between Entry Control Loop and Exit Control Loop
Comparison between Entry Control Loop and Exit Control Loop

Comparison Chart

Entry Control Loop Exit Control Loop
Entry control loop checks condition first and then
body of the loop will be executed.
The exit control loop first executes the body of the loop and
checks condition at last.
The body of the loop may or may not be executed at all. The body of the loop will be executed at least once because the condition is checked at last
for, while are an example of an entry control loop Do…while is an example of an exit control loop.




Entry Control Loop

  • For Loop
for( i=1; i < = 10; i++)
   {
    sum = sum + i ;
   }
  • While Loop
i=1;
   while(i<=10)
        {
         sum = sum + i; 
         i++
        }

Exit Control Loop

  • Do…While Loop
i=1;
do
 {
 sum = sum + i; 
 i ++;
 }
while(i<=10);




More Difference