Lesson 6 – For loop

When we write instructions and run the program, they are executed only once. However, there may be situations where we need to repeat some instructions a specific number of times. For example, if we want to input the marks of 30 students. In this case, using scanf function 30times is not an efficient way. In such cases, loop structures are used. The most commonly used loop in C language is the “for” loop.


for (initialization of looping variable; condition; increment or decrement of looping variable)

Looping Variable:

Any integer type variable that is used to count the number of times the loop has been executed.


It is defined to stop the loop. Loop continues until this condition evaluates to be true. This is evaluated after each iteration. As soon as this turns out to be false, the loop stops.


This clause determines how much the looping variable will be incremented/decremented after each iteration (round).