C Program to print first n natural numbers using for loop
Program
#include<stdio.h>
void main()
{
int i, n;
printf("Enter the value of n\t");
scanf("%d", &n);
printf("Printing natural numbers from 1 to %d\n", n);
for(i = 1; i <= n; i++)
printf("%d\t", i);
printf("\n");
}
Output
Enter the value of n 8
Printing natural numbers from 1 to 8
1 2 3 4 5 6 7 8