Pabon_SEC

Integer Inquiry

Feb 17th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. import java.math.BigInteger;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static void main(String [] args)
  7.     {
  8.         BigInteger bi,sum,a;
  9.  
  10.         Scanner sc = new Scanner(System.in);
  11.  
  12.         sum = BigInteger.ZERO;
  13.         a = BigInteger.ZERO;
  14.  
  15.         while(sc.hasNext())
  16.         {
  17.          
  18.             bi = sc.nextBigInteger();
  19.          
  20.             if(bi.equals(a) )
  21.             {
  22.                 break;
  23.             }
  24.  
  25.             sum = sum.add(bi);
  26.  
  27.         }
  28.  
  29.         System.out.println(sum);
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment