PROGRAM-17


// Program of summation of natural number
#include
#include
void main()
{
 clrscr();
 int num,n,sum=0;
 printf("Enter the number of natural number:  ");
 scanf("%d", &n);
 for(num=1;num<=n;num++)
 sum+=num;
 printf("sum of %d natural number  is=%5d\n",n,sum);
 getch();
}

Algorithm

·                     Start
·                     Declare num, n, sum=0 as integer
·                      Write(“the number of natural number”)
·                      Read(“the number of natural number”)
·                      for(num=1;num<=n;num++)
·                      sum+=num
·                      Read("sum of natural number”)
·                     Stop

#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 comments: