Graderpractice for programmers

Back to 254275 OOP - Labs 1-5 Review

G. Hello arrays

Problem

Write a method to the sum of an array of integers.

Template

class TaskA {

    public static void main(String[] args) {
        int[] numbers = Input.intArray();
        int result = sum(numbers);
        System.out.println(result);
    }

    public static int sum(int[] numbers) {
        // TODO: Your answer here
    }

}

You will require Input.java for easy array input.

Examples

Input

2,4,5

Output

11

Input

3,1,6,10,8

Output

28

Submit your solution

java