Problem
Given an array numbers of integer elements, write a function solution that returns the sum of the elements in numbers.
Constraints
- Each element in
numbersis an integer with an absolute value not exceeding 500. numbersis not empty, and its length does not exceed 100.
Test Case
| Test Case Number | numbers | return |
|---|---|---|
| 1 | [1] | 1 |
| 2 | [1, 2, 3, 4] | 10 |
| 3 | [-200, -10, 0, 10, 200] | 0 |
Explanation for Test Case 1
numbershas a single element1, so the sum is1.
Explanation for Test Case 2
- The sum of the elements in
numbersis1 + 2 + 3 + 4 = 10.
Explanation for Test Case 3
- The sum of the elements in
numbersis-200 + -10 + 0 + 10 + 200 = 0.