While loop



#include <stdio.h>
int main()
{
    // Don't forget to declare variables
    int i = 0;
    // While i is less than 10
    while (i < 10)
    {
        printf("%d\n", i);
        // Update i so the condition can be met eventually
        i++;
    }
    return 0;
}


Output :

0
1
2
3
4
5
6
7
8
9

0 Comments

Newest