C Loops

Set of instructions given to the compiler to execute set of statements until condition becomes false is called loops. The basic purpose of loop is code repetition that means same code repeted again and again. The loops in C language are used to execute a block of code or a part of the program several times.

Why use Loop in C language

Where need repetation of same code a number of times at that place use Loop in place of writing more than one statements. The way of the repetition will be forms a circle that's why repetition statements are called loops.

Advantages of loops in C

  • Reduce length of Code
  • take less memory space.
  • It helps to traverse the elements of array (which is covered in next pages).

Types of loops in C

  • do while
  • while
  • for

Difference between conditional and looping statement


Conditional statement executes only once in the program where as looping statements executes repeatedly several number of time.