View Code of Problem 112

import java.util.Scanner;
public class Main {
 	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
	while(in.hasNext()){
       int a=in.nextInt();
       int b=0;
       for(int i=a;i>0;i--){
       	int l=in.nextInt();
       	if(i==a&&l==0)break;
       	b=b+l;
       }
if(b!=0)
System.out.println(b);
	}

}

}

Double click to view unformatted code.


Back to problem 112