for Loop in C
For loop is a conditional iterative statement which is used to check certain conditions and then repeatedly execute a block of code untill the conditions are satisfied.
Syntax
Let's understand the syntax
-
The
initialization
statement is executed only once. -
Then, the
condition
is evaluated. If the condition is evaluated tofalse
, thefor
loop is terminated. -
If the condition is evaluated to
true
, statements inside the body of thefor
loop are executed, and theincrement/decrement
statement is updated. -
Again the
condition
is evaluated.
This process goes on until the condition
is false. When the condition is false, the loop terminates.
Let's write a C program to print numbers 1 to 10.
Program
Output
Join Our Social Media Connections
0 Comments