C Program to print first n natural numbers using do while 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);
i = 1;
do
{
printf("%d\t", i);
i++;
}while(i <= n);
printf("\n");
}
Output
Enter the value of n 10
Printing natural numbers from 1 to 10
1 2 3 4 5 6 7 8 9 10