RosettaCodeData/Task/Greatest-common-divisor/BASIC/greatest-common-divisor-1.basic
Ingy döt Net d066446780 langs a-z
2013-04-10 22:43:41 -07:00

13 lines
227 B
Text

function gcd(a%, b%)
if a > b then
factor = a
else
factor = b
end if
for l = factor to 1 step -1
if a mod l = 0 and b mod l = 0 then
gcd = l
end if
next l
gcd = 1
end function