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

11 lines
168 B
AppleScript
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
on hcf(a, b)
repeat until (b = 0)
set x to a
set a to b
set b to x mod b
end repeat
if (a < 0) then return -a
return a
end hcf