Loops

You may encounter situations, when a block of code needs to be executed several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on.

Programming languages provide various control structures that allow for more complicated execution paths.

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 −

loop-flowchart

Types Of Loop Control Statements

There are 3 types of loop control statements in C language. They are,

  1. for
  2. while
  3. do-while

Syntax

loops-image