LOOP iteration or repetition controls

In C programming, loops are used to repeat a block of code multiple times. There are three primary types of loops in C:

  1. while

The while loop repeats a block of code as long as the specified condition is true. The condition is checked before each iteration.

  1. do-while

The do-while loop is similar to the while loop, but it guarantees at least one execution of the code block, because the condition is checked after the execution.

  1. for

The for loop is used when the number of iterations is known beforehand. It consists of three parts: initialization, condition, and increment/decrement.