Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

Commit

Permalink
Merge pull request #2321 from maciej7777/master
Browse files Browse the repository at this point in the history
Merged by aniket965
  • Loading branch information
Aniket965 committed Oct 13, 2018
2 parents d5175d8 + 3c101c6 commit 0a8eb60
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Java/Mathematics/LCM.java
@@ -0,0 +1,19 @@
package Mathematics;

import static Mathematics.EuclidGCD.gcd;

/**
* Calculates lowest common multiple for given integer numbers
*/
public class LCM {
public static void main(String[] args) {
System.out.println(lcm(2, 5));
System.out.println(lcm(15, 3));
System.out.println(lcm(75, 10));
}

public static int lcm(int a, int b) {
return a * b / gcd(a, b);
}

}

0 comments on commit 0a8eb60

Please sign in to comment.