Computer Science, asked by sheela9213, 2 months ago

Write a program to find the sum of n natural numbers.​

Answers

Answered by skneka16
4

Answer:

C Program to Find the Sum of First N Natural Numbers

* C program to find the sum of 'N' natural numbers.

int i, num, sum = 0;

printf("Enter an integer number \n");

scanf ("%d", &num);

for (i = 1; i <= num; i++)

sum = sum + i;

printf ("Sum of first %d natural numbers = %d\n", num, sum);

Answered by Anonymous
0

Sum of n natural numbers are

s =  (\: n \div 2) \:  ( 2a + (n - 1)d )

Similar questions