How to use for Loop in C Language
For Loop
On this page
For Loop
Program to use for Loop in C Language
#include <stdio.h>
int main()
{
int i;
for (i = 1; i <= 5; i++)
{
printf("%d\t", i);
}
printf("\n");
return 0;
}
Output
1 2 3 4 5
Steps Description
- Created a variable named i inside the integer, initialized i=1 inside the for loop that i++ will continue to happen until the value of i becomes 5