Java lcm lcm(long x, long y)

Here you can find the source of lcm(long x, long y)

Description

lcm

License

Open Source License

Declaration

static long lcm(long x, long y) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    static long lcm(long x, long y) {
        return x * y / gcd(x, y);
    }/*from  w  ww .  j a va2s .c  o m*/

    static long gcd(long x, long y) {
        long a = x, b = y, r = 0;
        while (b != 0) {
            r = a % b;
            a = b;
            b = r;
        }
        return a;
    }
}

Related

  1. lcm(int x1, int x2)
  2. lcm(long a, long b)
  3. lcm(long a, long b)
  4. lcm(long a, long b)
  5. lcm(long u, long v)
  6. lcm(long[] a)
  7. LCM1(int A, int B)
  8. lcmPositive(int... args)