Multiple Integer Addition

View as PDF

Submit solution

Points: 4
Time limit: 2.0s
Memory limit: 62M

Author:
Problem type

Your task is to add together a series of integers and output the sum of them all.

Input Specification

The first line of input, n (1 \le n \le 30), will be the number of integers that need to be added together.
The next n lines will each contain an integer, n_i (0 \le n_i \le 2^{31}-1), representing a number that must be added.

Output Specification

The output should be the sum of all integers. It is guaranteed that this sum will be less than 2^{31}-1.

Sample Input

3
5
9
2

Output for Sample Input

16

Explanation for Sample Output

The first line of input, 3, shows that there are 3 numbers that need to be added.
The next 3 lines contian the integers 5, 9, and 2. This means our output should be the result of 5 + 9 + 2, which is 16.


Comments

There are no comments at the moment.