Problem B
Summing Integers
Write a program using a while statement, that given a series of numbers as input, adds them up until the input is $10$ and then prints the total. Without adding the final $10$.
Input
Input consists of $n$ lines, where $1 \leq n \leq 1\, 000$. The $i$th line contains one integer $a_i$, where $0 \leq a_i \leq 100$. It is guaranteed that $a_n = 10$.
Output
Output consists of one line with one integer, the sum of the numbers given excluding the final $10$.
Sample Input 1 | Sample Output 1 |
---|---|
8 3 11 10 |
22 |
Sample Input 2 | Sample Output 2 |
---|---|
1 2 5 7 9 8 3 12 20 3 4 7 10 |
81 |
Sample Input 3 | Sample Output 3 |
---|---|
10 |
0 |