15 lines
253 B
Text
15 lines
253 B
Text
gcd = function(a, b)
|
|
while b
|
|
temp = b
|
|
b = a % b
|
|
a = temp
|
|
end while
|
|
return abs(a)
|
|
end function
|
|
|
|
lcm = function(a,b)
|
|
if not a and not b then return 0
|
|
return abs(a * b) / gcd(a, b)
|
|
end function
|
|
|
|
print lcm(18,12)
|