大数的四则运算

    科技2025-11-19  3

    不必多说直接上代码自己体会

    package LCL; import java.math.BigInteger; public class test1 { public static void main(String[] args) { BigInteger a=new BigInteger("124568412316516570451632431045644123135463215432153120543"); BigInteger b=new BigInteger("123456754756765865658584452421212013153153453438756864543"); getadd(a,b); getsubtract(a,b); getmutiply(a,b); getdivide(a,b); } public static void getadd(BigInteger a,BigInteger b) { System.out.println(a.add(b)); } public static void getsubtract(BigInteger a,BigInteger b) { System.out.println(a.subtract(b)); } public static void getmutiply(BigInteger a,BigInteger b) { System.out.println(a.multiply(b)); } public static void getdivide(BigInteger a,BigInteger b) { System.out.println(a.divide(b)); } }
    Processed: 0.010, SQL: 8