Index « Previous Next »

Question

Write a program to print numbers from 1 to 10.

Source Code

#include <stdio.h>

int main()
{
    int i;
    
    for (i = 1; i <= 10; i++)
    {
        printf("%d ", i);
    }
    
    return 0;
}

Output

1 2 3 4 5 6 7 8 9 10