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

7 lines
89 B
Lua
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
function gcd(a,b)
while b~=0 do
a,b=b,a%b
end
return math.abs(a)
end