elibraryportal Logo

For Loop Statement in C

For loop statement is used to executing a block of statements repeatedly until a given condition returns false.

Syntax:

See in Fig.

For Loop Statement Exaplme in C
  • First initialize the variable, It execute only once when we are entering into the loop first time.
  • In second step is that check the condition.
  • In third step is that control goes inside loop body and execute
  • In last increase the value of variable
  • This process is repeat until condition not false.

Example 1:

Output

1
2
3
4

Example 2:

Output

0  0  0
1  3  4
2  6  8
3  9  12

Example 3:

Output

0  2
1  4
2  6
3  8
4  10
5  12