for loop(Programme in C)
for loop(Programme in C)
//title: for loop
//brief:
prints value of i for each iteration starting from 1 to 10 using for
loop.
//result:
Value of i: 1
//
Value of i: 2
//
Value of i: 3
//
Value of i: 4
//
Value of i: 5
//
Value of i: 6
//
Value of i: 7
//
Value of i: 8
//
Value of i: 9
//
Value of i: 10
#include <stdio.h>
#include <stdlib.h>
//start of main function
int main()
{
//variable declaration
int i;
for (i = 1; i <= 10;
i++) //init i with 1, increment i on
each iteration and repeat till i<=10
{
printf("Value of i: %d\n", i);
//print value of i each time
}
//terminate main function and return 0 as output
return 0;
}
Comments
Post a Comment