Sum of an Array
Given a list of integers, print their sum.
Input: the first line has an integer N; the second line has N integers separated by spaces.
Output: one integer — the sum of the N values.
Constraints:
- 1 ≤ N ≤ 2000
- −109 ≤ ai ≤ 109
Sample Tests
Input 1
4 3 -1 10 5
Output 1
17
Input 2
2 -7 -8
Output 2
-15
Discussion (opens after you solve — no spoilers before)
No comments yet.