Loops are used in programming to repeat a specific block until some end condition is met. There are three loops in C programming:

  1. while loop
  2. do…while loop
  3. for loop

while loop in C programming repeatedly executes a target statement as long as a given condition is true.

The general form of while is as Follows:

intialise loop counter;

while (test loop counter using condition)

{

do this;

do this;

Increment / decrements loop counter;

}

flowchart while loop
flowchart while loop

The do ……while loop.

The syntax of do … while loop is as fallows.

do

{

this;

and this;

and this;

while(this condition is true);

do.... while loop
Flowchart do…. while loop

For loop :

The general form of for statement is as under:
for ( initialize loop counter; test counter; increment counter)
{
do this;
and this;
and this;
}

for loop
Flow chart for loop