java大數輕鬆過

 1 import java.util.Scanner;  2 import java.math.BigInteger;  3 public class Main {  4     public static void main(String[] args) {  5         Scanner scan = new Scanner(System.in);  6         BigInteger a = scan.nextBigInteger();  7         BigInteger b = scan.nextBigInteger();  8         System.out.println(a+" + "+b+" = "+a.add(b));  9         System.out.println(a+" - "+b+" = "+a.subtract(b)); 10         System.out.println(a+" * "+b+" = "+a.multiply(b)); 11         System.out.println(a+" / "+b+" = "+a.divide(b)); 12  } 13 }
相關文章
相關標籤/搜索