Looping refers to the ability of a block of code to repeat itself. Specific number of times until some condition is satisfied.
The for loop is the basic type of loop and resembles a for in mist other programming language including ANS “C”.
In for loop, expression 1 sets up a counter variable and assigns the initial value. The declaration of the counter variable con also be done here itself. Expression 2 specifies how the initial value expression 1 is incremented/decremented. Condition is a logical expression the determine the number of iteration required.
The while loop provides a similar functionality. While loop is also known as entry controlled loop.
The do-while loop is also known as exit controlled loop as condition is evaluated at the bottom of the loop.
In do-while loop, also a set of statement is executed repeatedly until condition become FALSE.