Computer Science, asked by sheela9213, 7 months ago

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

Answers

Answered by Anonymous
2

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);

Similar questions