Looping in C programming language

You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially i.e. The first statement in a function is executed first, followed by the second, and so on. But in our programs, there may be a need of doing repetitive work which can be easily done with the help of loops. Looping is one of the key concepts in any programming language which executes a block of statements number of times until the condition becomes false. 

A loop statement allows us to execute a statement or group of statements multiple times. Given below is the general form of a loop statement in most of the programming languages

Let’s assume if we have to make a program which contain natural no. from 1 to 40 then you may write 40’s of ‘printf’ statements and can write it but if we have to make a program to write first 2000 natural numbers then it going to be really difficult task. So, to overcome these types of hard works we use loops.

In Looping program executes a block of code again and again or repeatedly until the condition become false.

Loops are very basic and very useful programming facility that facilitates programmer to execute any block of code repeatedly and can be controlled as per the conditions put by the programmer. 

Basic flowchart of a loop