iteration or loop

                     

Iteration (loop)

One or  more statements in C language can be executed more than once depending upon some condition or unconditionally.

This repetition is called iteration or loop.

Or

 

The process of repeating sequence instruction over again and again is known as loop.

OR

In other words in looping a sequence of statement of loop are satisfy.

OR

Set of instructions  given to the compiler to execute  set of statements until the condition becomes false, it is called as loop.

A typical loop consists of three components.

Initialization (where to start)

Condition (Where to end)

Interval (Increment or Decrement)

Loops can be formed by any of the three statements.

While

Do….while

For

Entry control loop(while)

The while loop continues to execute the given statements until the  condition becomes false or the expression evaluates  to zero.

It is called  as entry controlled loop or pre tested loop because the testing of condition/expression is done before executing the statements.

{

Statement/statements

}

Exit control loop (do…..while)

Do….while  repeatedly executes the given statements until the condition becomes false or expression  to zero.

It is called as exit control loop or post tested loop because the statement are executed before the testing of condition/expression.

 

Do{

Statement/statement;

}while(Condition/expression);

 

Scroll Up