3 Differences between entry and exit controlled loops with examples. Entry controlled loops VS Exit controlled loops



The differences between the entry and exit controlled loops are as follows.

Read More: What are the entry controlled and exit controlled loops?

No.
Topics
Entry controlled loops
Exit controlled loops
01
Test condition
Test condition appears at the beginning.
Test condition appears at the end.
02
Control variable
Control variable is counter variable.
Control variable is counter & sentinel variable.
03
Execution
Each execution occurs by testing   condition.
Each execution except the first one occurs by testing condition.
04
Examples
= = = = = = = =
sum = 0;
n = 1;
while (n <= 10)
{
sum = sum + n*n;
n = n+ 1;
}
= = = = = = = =
= = = = = =
do
{
printf(“Input a number.\n”);
scanf("%d", &num);
}
while(num>0);
= = = = = =

Recommended Recommends

Comments

Contact Us