📜  两个大正整数的lcm java代码示例

📅  最后修改于: 2022-03-11 14:52:34.506000             🧑  作者: Mango

代码示例1
import java.util.Scanner;
import java.math.BigInteger;
public class LCM2N {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        BigInteger a = sc.nextBigInteger();
        BigInteger b = sc.nextBigInteger();
        System.out.println(a.multiply(b).divide(a.gcd(b)));
         // lcm(121212121212121212,45678978) = 102534181818181818079284
    }
}