public class LowestCommonMultiple {
    public static void main(String[] args) {
        System.out.println(lcm(77,  63));
    }

    public static int lcm(int a, int b) {
        int d = gcd(a, b);

        return a * b / d;
    }

    public static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        }

        return gcd(b, a % b);
    }
}
Copyright © iovi.com 2017 all right reserved,powered by GitbookLast Modification: 2019-12-04 08:54:38

results matching ""

    No results matching ""