Example: Summing up Numbers

Write a program that inputs n integers and sums them up.

  • On the first row of the input, enter the number of integers n.
  • Enter one number on each of the following n rows.
  • Sum up the numbers and finally print the result.

Sample Input and Output

Input Output
2
10
20
30
3
-10
-20
-30
-60
4
45
-20
7
11
43
1
999
999
0 0

results matching ""

    No results matching ""