Easy Tutorial
❮ C Exercise Example73 C Function Modf ❯

C for Loop

C Loops

The for loop allows you to write a loop control structure that executes a specified number of times.

Syntax

The syntax of a for loop in C language:

for ( init; condition; increment )
{
   statement(s);
}

Here is the control flow of the for loop:

Flowchart

Example

Example

#include <stdio.h>

int main ()
{
   /* for loop execution */
   for( int a = 10; a < 20; a = a + 1 )
   {
      printf("value of a: %d\n", a);
   }

   return 0;
}

When the above code is compiled and executed, it produces the following result:

value of a: 10
value of a: 11
value of a: 12
value of a: 13
value of a: 14
value of a: 15
value of a: 16
value of a: 17
value of a: 18
value of a: 19

C Loops

❮ C Exercise Example73 C Function Modf ❯