View Code of Problem 112

import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while(scanner.hasNext()) {
			String[] s = scanner.nextLine().split(" ");
			if(s[0] .equals("0")) {
				break;
			}
			int n = Integer.valueOf(s[0]);
			int sum=0;
			for(int i=1; i<s.length; i++) {
				sum+= Integer.valueOf(s[i]);
			}
			System.out.println(sum);
		}
	}
}

Double click to view unformatted code.


Back to problem 112