17 lines
249 B
Text
17 lines
249 B
Text
function gcdI(x, y)
|
|
while y
|
|
t = y
|
|
y = x mod y
|
|
x = t
|
|
end while
|
|
|
|
return x
|
|
end function
|
|
|
|
# ------ test ------
|
|
a = 111111111111111
|
|
b = 11111
|
|
|
|
print : print "GCD(";a;", ";b;") = "; gcdI(a, b)
|
|
print : print "GCD(";a;", 111) = "; gcdI(a, 111)
|
|
end
|