RosettaCodeData/Task/Least-common-multiple/MiniScript/least-common-multiple.mini

16 lines
253 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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)