B. Summation

Problem Setup

  • login to CS50 IDE
  • write cd in the terminal to go to the home directory
  • write mkdir summation-2 to create a folder called summation-2
  • write cd summation-2 to go to the summation-2 folder
  • write code summation-2.cpp to create a file called summation-2.cpp and open it in the editor

Problem

Given an array of \(n\) elements, implement a function that finds the summation of the array.

Input

The first line of input contains an integer \(n\) where \(1 \leq n \leq 1000\), denoting the number of elements in the array.

The second line contains \(n\) integers separated by space, where \(1 \leq a_i \leq 1000\) — representing the elements of the array.

Output

Output the summation of the array.

Examples

Example 1:

Input:

5
1 5 3 2 4

Output:

15

Example 2:

Input:

7
1 4 3 4 3 2 5

Output:

22

Test Your Code

Make sure you are in the summation-2 directory, then run the following command:

check50 iti-technical-team/week3/2026/3/summation-2

Submit Your Code

Make sure you are in the summation-2 directory, then run the following command:

submit50 iti-technical-team/week3/2026/3/summation-2