C loop control structure


C loop control structure


What is a loop


A loop is a part of code of a program which is executed repeatedly.

The versatility of the computer lies in its ability to perform a set of instructions repeatedly.
This involves repeating some portion of the program either a specified number of times or until
a particular condition is being satisfied. This repetitive operation is done through a loop control structure.

A loop is used using condition. The repetition is done until condition becomes condition true.

A loop declaration and execution can be done in following ways.

  • Check condition to start a loop
  • Initialize loop with declaring a variable.
  • Executing statements inside loop.
  • Increment or decrement of value of a variable.
Types of Looping statements:

There are two types of looping statements:
  1. Entry control loop
  2. Exit control loop



1. Entry control loop :

In this type of loop, the test condition is checked first before the loop is executed.

Examples of this looping statements are :
(click on the red links...)

2. Exit control loop :

In such type of loop, the loop is executed first. Then condition is checked after block of statements are executed. The loop executed atleat one time compulsarily.

Example of this looping statement is :



     Prev                                                   NEXT

0 comments:

Post a Comment