The sum of elements

Report a typo

Find the sum of all elements in a sequence, ending with 0.

The number 0 itself is not included in the sequence and serves as a sign that the sequence ended. Although, if you add 0, nothing bad will happen :)

Sample Input 1:

3
6
8
0

Sample Output 1:

17
Write a program in Kotlin
fun main() {
// put your code here
}
___

Create a free account to access the full topic