Java(求最小公倍数)

import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNext())
        {
            BigInteger a,b;
            a=in.nextBigInteger();
            b=in.nextBigInteger();
            BigInteger temp;
            temp=a.multiply(b).divide(a.gcd(b));
            System.out.println(temp);
        }
    }
}

你可能感兴趣的:(Java)