Sunday, June 7, 2015

UVa 424 - Integer Inquiry

// UVa 424 - Integer Inquiry

import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		BigInteger s = BigInteger.ZERO;
		Scanner scan = new Scanner(System.in);
		BigInteger n = scan.nextBigInteger();
		while (n.compareTo(BigInteger.ZERO) != 0) {
			s = s.add(n);
			n = scan.nextBigInteger();
		}
		System.out.println(s);
	}

}

No comments:

Post a Comment