Computer Science, asked by deeparsh58889, 4 months ago

write a program in C to print the sum of first n natural numbers ?​

Answers

Answered by madhavisingh6263
0

Answer:

0 is the natural number.

Answered by sougatap57
0

Answer:

#include <stdio.h>

int main()

{

   int a,n,sum;

   /* it is the range of naturalnumbers*/

   printf("enter the range ");

   scanf("%d",&n);

   for(a=1;a<=n;a++)

   {

       sum=sum+a;

   }

   printf("the sum of natural is=%d",sum);

   return 0;

}

Output:-

enter the range 6

the sum of natural is 21

Similar questions