func gcd a b . while b <> 0 h = b b = a mod b a = h . return a . func lcm a b . return a / gcd a b * b . print lcm 12 18