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);
= = = = = =

Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends

Comments

Contact Us