View Code of Problem 112

import java.util.*;
public class Main {
	 public static void main(String[] args) {
		 Scanner in = new Scanner(System.in);
		 while(in.hasNext()){
			 int n =in.nextInt();
			 if(n==0) {
				 break;
			 }
			 int s=0;
			 for(int i=0;i<n;i++ ) {
				 int a =in.nextInt();
				 s+=a;
			 }
			System.out.println(s); 		
		 }
	 }
}

Double click to view unformatted code.


Back to problem 112