Write about Entry controlled loop and 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:

 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.

entry controlled 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 post–test loop.

exit controlled 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

Nesting of for loops in java

Nesting of loops, i.e., one for statement with in another for statement is allowed in Java. For ex:–two loops can be nested as follows. The nesting may continue up to any desired ...

Method Overloading in Java

In java it  is  possible to create  methods that have  the same but  different  parameter lists  and  different definitions . This is called  method ...

Explain different levels of access modifier available in java for protection.

It is possible to inherit all the members of a class by a subclass using the keyword extends. However, it may be necessary in some situations to restrict the access to certain variabl...

Post a Comment

emo-but-icon
:noprob:
:smile:
:shy:
:trope:
:sneered:
:happy:
:escort:
:rapt:
:love:
:heart:
:angry:
:hate:
:sad:
:sigh:
:disappointed:
:cry:
:fear:
:surprise:
:unbelieve:
:shit:
:like:
:dislike:
:clap:
:cuff:
:fist:
:ok:
:file:
:link:
:place:
:contact:

item