Computer Science, asked by sabzsabz50, 4 months ago

write a program in c to add first
20 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