A natural number is a number that occurs commonly and obviously in nature. As such, it is a whole, non-negative number. The set of natural numbers, denoted N, can be defined in either of two ways:
N = {0, 1, 2, 3, …}
N = (1, 2, 3, 4, …}
#include
#include
void main()
{
int i,sum=0;
clrscr();
printf(“Natural numbers are\n");
for(i=1;i<=10;i++)
{
printf(“%d\t”,i);
sum=sum+i;
}
printf(“sum =%d”,sum);
getch();
}
Output:
natural numbers are 1 2 3 4 5 6 7 8 9 10
sum=55