C Programming Code Examples C > For Loops and While Loops Code Examples For Loop Statement in C programming language For Loop Statement in C programming language - First initialization happens and the counter variable gets initialized. - In the second step the condition is checked, where the counter variable is tested for the given condition, if the condition returns true then the C statements inside the body of for loop gets executed, if the condition returns false then the for loop gets terminated and the control comes out of the loop. - After successful execution of statements inside the body of loop, the counter variable is incremented or decremented, depending on the operation (++ or --). #include <stdio.h> int main() { int x; for (x=1; x<=3; x++) { printf("%d\n", x); } return 0; }