LCM dari dua bilangan bulat positif besar Java
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
}
}
BreadCode