RosettaCodeData/Task/Greatest-common-divisor/AppleScript/greatest-common-divisor-1.applescript

13 lines
192 B
AppleScript
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
-- gcd :: Int -> Int -> Int
on gcd(a, b)
if b 0 then
gcd(b, a mod b)
else
if a < 0 then
-a
else
a
end if
end if
end gcd