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 }

 

posted @ 2018-05-08 00:06  霜雪千年  阅读(129)  评论(0编辑  收藏  举报