HTML Tutorial || Networking Assignment || Computer Full Forms || Ms-Office Shortcut Keys || Ms-Office Notes || Number System Notes || Internet Assignment
JavaScript Tutorial || CSS Tutorial || Operating System Notes || History of Computer Assignment || Netwoking Notes || Computer Fundamentals Notes

C Program to Print All Natural Numbers From 1 to n Using For Loop


Q:- Write a C Program to Print All Natural Numbers From 1 to n Using For Loop ?
      Input
        #include<stdio.h>
        #include<conio.h>
        main()
    {
int num,i;
clrscr();
printf(“Enter a Limit of N=”);
scanf(“%d”,&num);
for(i=1;i<=num;i++)
{
printf(“%d\n”,i);
}
getch();
    }
\

Output

Enter a Limit of N = 5
1
2
3
4
5

Comments