Print N Natural Numbers:-
In this c program we will print N natural numbers by input values from user. Here we take two int type of variables name as num, i. num for store user input as last number and i variable for counter, i initialize with value 1 and iterate until the given condition become false i<=num.
/*
Program : N Natural Numbers
Filename : nNaturalNumber.c
IDE Used To Developed : CodeBlocks
Developed By : Pavito Golui
*/
#include<stdio.h>
int main()
{
int num,i;
printf("Enter the last number :");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
printf("%d \n",i);
}
return 0;
}
Program : N Natural Numbers
Filename : nNaturalNumber.c
IDE Used To Developed : CodeBlocks
Developed By : Pavito Golui
*/
#include<stdio.h>
int main()
{
int num,i;
printf("Enter the last number :");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
printf("%d \n",i);
}
return 0;
}
Output :
Enter the last number :15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0 comments:
Welcome to you in All Coding Help