RosettaCodeData/Task/Greatest-common-divisor/Lua/greatest-common-divisor-2.lua

7 lines
89 B
Lua
Raw Permalink Normal View History

2019-09-12 10:33:56 -07:00
function gcd(a,b)
while b~=0 do
a,b=b,a%b
end
return math.abs(a)
end