Previous Next
0 / 5
Module DEMO-32-107DEMO-C-32

Sum of Array Elements

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a function getSum that returns the sum of all elements in the given array.

Constraints

1 <= n <= 100

Input Format

n, array

Output Format

Sum

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
5
1 2 3 4 5
15
Sample #2
Public sample
3
-5 -5 -5
-15

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings