Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int n, i=1;
printf("Enter a number :");
scanf("%d", &n);
printf("Natural Numbers from 1 to %d is :\n\n". n);
while(i<=n)
{
printf("\t%d", i);
i++;
}
getch();
}
Output:
Enter a Number : 10
Natural Numbers from 1 to 10 is :
1 2 3 4 5 6 7 8 9 10
Next Topic :
Previous Topic :
No comments:
Post a Comment