index
| submit
| rank
| book

## total – Total

Write a program that computes the total, i.e. sum, of a given list of numbers.

### Input and Output

Input begins with a line containing an integer *n*
indicating the number of lines that follow.
The number *n* should not be included in the sum.
Each of the *n* following lines contain an integer *xₘ*
to be accounted for the sum.

Your program should work for *n* and *xₘ* in the following ranges:

1 ≤ *n* ≤ 1000

0 ≤ *xₘ* ≤ 100 000

Output should contain a single line with an integer
*t* = *x₁ + x₂ + x₃ + … + xₙ*.

#### Example input 1

```
3
1
2
3
```

#### Example output 1

```
6
```

#### Example input 2

```
5
10
20
30
40
50
```

#### Example output 2

```
150
```

### Scoring

- 2/10: works for the above example input and output cases
- 4/10: produces output in the correct format for the above example I/O cases
- 10/10: works for other test cases

### Hints

This exercise can be solved *without* storing all values in memory
at the same time,
i.e.: without resorting to arrays or lists.
– *O(1)* memory usage.

In this exercise the input numbers are given
across *multiple lines* of input.

try first: hello2

try next: countdown1

index
| submit
| rank
| book

Copyright © 2020-2021 Rudy Matela

All rights reserved