C program to display first n natural numbers using for loop
/***********************************************************
C program to display first n natural numbers
***********************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,num;
clrscr();
printf("** OUTPUT**\n");
printf("How many natural number you wants to display\n");
scanf("%d",&num);
printf("First N natural numbers are\n");
for(i=0;i<=num;i++)
{
printf("%d\n",i);
}
printf("End of program");
}
** OUTPUT**
How many natural number you wants to display
7
First N natural numbers are
0
1
2
3
4
5
6
7
End of program
0 टिप्पण्या
कृपया तुमच्या प्रियजनांना लेख शेअर करा आणि तुमचा अभिप्राय जरूर नोंदवा. 🙏 🙏