B. Summation

Problem Setup

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

Problem

Given \(n\) integers, you need to calculate the sum of all of them.

Input

The first line contains an integer \(n\) where \(1 \leq n \leq 100\) — the number of integers.

The second line contains \(n\) integers \(a_1, a_2, \ldots, a_n\) where \(-100 \leq a_i \leq 100\) — the integers.

Output

Print the sum of all integers.

Examples

Example 1:

Input:

5
2 4 3 1 5

Output:

15

Example 2:

Input:

7
1 5 2 10 -4 -3 6

Output:

17

Test Your Code

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

check50 iti-technical-team/problemset/2026/2/summation

Submit Your Code

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

submit50 iti-technical-team/problemset/2026/2/summation