GCD and LCM

E · easyP · Verified PYQmath

Find the GCD (Greatest Common Divisor) and LCM (Least Common Multiple) of two numbers.

Input
12 18
Output
GCD: 6
LCM: 36
Use Euclidean algorithm for GCD: gcd(a,b) = gcd(b, a%b). LCM = (a\*b) / gcd(a,b).
← Find Second Largest in ArrayGCD of Two Numbers →
Report an issue with this question