Write a program that inputs
n integers and sums them up.
- The first line of the input holds the number of integers
- Each of the following
nlines holds an integer for summing.
- Sum up the numbers and finally print the result.
Watch this video to learn how to sum numbers in for-loop: https://youtu.be/t7PAichwl7k.
We can solve the problem with summing up numbers in the following way:
- We read the input number
- We initially start with a sum
sum = 0.
- We run a loop from 1 to
n. On each step of the loop, we read the number
numand add it to the sum
- Finally, we print the calculated amount
Below is the source code for the solution:
Test your solution here: https://judge.softuni.org/Contests/Practice/Index/510#3.