Introduction
C Programming
C Advanced
Important C Programs
Modal Box
Tutorials
For Loop
In for loop, the first part begins with variable’s initialization, followed by the condition and increment/decrement operation on the variable.
The first part (initialization) and the last part (increment/decrement) may not be present, but the semicolon is there.
Syntax for For loop
for(initialization; condition; increment/decrement)
{
// body statement to be executed
}
Examples :
Print no's from 1 to 100
#include <stdio.h> #include <conio.h> void main() {
int i; for(i=1;i<=100;i++) { printf("%d ",i); }
}
Infinite for loop
for( ; ; )
{
}
Video/ C Introduction
Watch video in full size