Java lcm lcm(int a, int b)

Here you can find the source of lcm(int a, int b)

Description

lcm

License

Open Source License

Declaration

private static int lcm(int a, int b) 

Method Source Code

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

public class Main {
    private static int lcm(int a, int b) {
        return a * b / gcd(a, b);
    }//from   ww  w  .ja  v  a2  s  .c om

    private static int gcd(int a1, int b1) {
        int a;
        int b;
        if (a1 > b1) {
            a = a1;
            b = b1;
        } else {
            b = a1;
            a = b1;
        }
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
}

Related

  1. lcm(int a, int b)
  2. lcm(int a, int b)
  3. lcm(int a, int b)
  4. lcm(int a, int b)
  5. lcm(int a, int b)
  6. lcm(int a, int b)
  7. lcm(int a, int b)
  8. lcm(int a, int b)
  9. lcm(int a, int b)