Concept Flow - GCD and LCM Euclidean Algorithm
Start with two numbers a, b
Check if b == 0?
Yes→GCD is a
No
Calculate a % b
Set a = b, b = a % b
Repeat until b == 0
Calculate LCM = (original_a * original_b) / GCD
Done
Start with two numbers, repeatedly replace a by b and b by a mod b until b is zero. The last non-zero a is the GCD. Then compute LCM using the formula.
