There are two types of loops.
1. Entry Controlled / Top tested/ Pre tested Loops.
In this type of loop the contions is tested first and the execute the set statements.
e.g
whitle(<condition>)
{
.
.
Set of statements
}
2. Exit controlled / Bottom Tested / Post Tested loops.
In this type of loop the set of statement is executed first then condition is tested.
e.g.
do
{
.
.
Set of statements
}
while(<Condition>);
In this type of loop the statement will be executed once even if conditon is false.
1. Entry Controlled / Top tested/ Pre tested Loops.
In this type of loop the contions is tested first and the execute the set statements.
e.g
whitle(<condition>)
{
.
.
Set of statements
}
2. Exit controlled / Bottom Tested / Post Tested loops.
In this type of loop the set of statement is executed first then condition is tested.
e.g.
do
{
.
.
Set of statements
}
while(<Condition>);
In this type of loop the statement will be executed once even if conditon is false.
No comments:
Post a Comment