Define Entry Controlled Loop & Exit Controlled Loop?

Loop means, A sequence of statements are executed until some conditions for termination of the loop are satisfied.

A program loop consists of 2 segments

1. Body of the loop &
2. Control statement.

The control statement tests certain conditions & then directs the repeated execution of the statements contained in the body of the loop.

Depending on the position of the control statement in the loop, a control structure may be classified either as the entry may be classified either as the entry controlled loop or as the exit–controlled loop.

entry controlled loop exit controlled loop


Entry controlled loop:

 In the entry controlled loop, the control conditions are tested before the start of the loop execution. If the conditions are not satisfied, then the body of the loop will be executed. It is also known as pre–test loop.

Exit controlled loop:

In the case of an exit–controlled loop, the test is performed at the end of the body of the loop execution. If the conditions are not satisfied, then the body of the loop will not be executed. It is also known as pre–test loop.

A looping process, would include the following 4 steps:

1. Setting & initialization of a condition, variables.

2. Execution of the statements in the loop.

3. Test for a specified value of the con variable for execution of the loop.

4. Incrementing or updating the con. Variable.

The test may be either to determine whether the loop has been repeated the specified no of times or to determine whether a particular con has been met.

Related

C Language 2006350432732216135

Post a Comment

emo-but-icon

item