Suppose block of statements has to be executed repeatedly, then instead of writing those statements multiple times, loops are used.
The looping statements are used to execute a single statement or block of statements repeatedly until the given condition is FALSE. So if i have to print myname 100 times, then instead of writing printf hundred times, we can use loop with condition that executes 100 times.
Types of the Loops in C :
- while statement
- do-while statement
- for statement