> ## Documentation Index
> Fetch the complete documentation index at: https://learn.acadlink.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Sum of Array Elements

> Find the sum of all elements in an array.

## Problem Statement

Write a C program that takes N integers as input and finds the sum of all elements in the array.

## Solution

```c theme={null}
#include <stdio.h>

int main() {
    int n, sum = 0;
    scanf("%d", &n);
    int arr[n];
    for (int i = 0; i < n; i++) scanf("%d", &arr[i]);
    for (int i = 0; i < n; i++) sum += arr[i];
    printf("Sum = %d\n", sum);
    return 0;
}
```

## Input

```
5
1 2 3 4 5
```

## Output

```
Sum = 15
```
