Pages

Labels

C Program to display Number from 1 to 10

Display all numbers between 1 to 10

#include<stdio.h>
#include<conio.h>
main() {
    int i;
    for(i=1;i<=10;i++) {
        printf("%d\n",i);
    }
}

Output:
1
2
3
4
5
6
7
8
9
10

How it works
Runs a loop from 1 to 10 by adding 1 on each current loop value.
Example:
1 
1+1 = 2
2 + 1 = 3
....
9 + 1 =  10

Followers