**C program to find sum of n numbers** is a very easy and simple program. Generally, such programs asked in the exam. This is the basic program in c.

**Example: **

Suppose we have the 4 numbers as 10, 20, 30, 40

Sum of N numbers will add all 4 numbers = 10 + 20 + 10 + 10

Sum of 4 numbers is = 50

**Logic to implement sum of N number program**

We take the N from the user that is how many number users want to add next. After that using for loop we take N number input from a user and simultaneously we add number user enters.

## C program to find sum of n numbers

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#include <stdio.h> int main() { int n, sum = 0, c, value; printf("How many numbers you want to add?\n"); scanf("%d", &n); printf("Enter %d integers\n", n); for (c = 1; c <= n; c++) { scanf("%d", &value); sum = sum + value; } printf("Sum of the integers = %d\n", sum); return 0; } |

**Output:**

## Leave a Reply