For Loop - Devbhoomi

FREE JOB ALERT & ONLINE TUTORIALS

Hot

Post Top Ad

Monday 6 November 2017

For Loop

#include<stdio.h>

int main()
{
    int i;

    /* 
        The loop goes while i < 10, 
        and i increases by one every loop 
    */

    for (i = 0; i < 10; i++)
    {
        /* Keep in mind that the loop condition checks
           the conditional statement before it loops again.
           consequently, when i equals 10 the loop breaks.
           i is updated before the condition is checked. */

        printf("%d\n", i);
    }
    return 0;
}
OUTPUT
0
1
2
3
4
5
6
7
8
9

No comments:

Post a Comment

Post Top Ad