Greatest common divisor: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 4,509: | Line 4,509: | ||
\Display the GCD of two integers entered on command line |
\Display the GCD of two integers entered on command line |
||
IntOut(0, GCD(IntIn(8), IntIn(8)))</lang> |
IntOut(0, GCD(IntIn(8), IntIn(8)))</lang> |
||
=={{header|Yabasic}}== |
|||
<lang Yabasic>sub gcd(u, v) |
|||
local t |
|||
u = int(abs(u)) |
|||
v = int(abs(v)) |
|||
while(v) |
|||
t = u |
|||
u = v |
|||
v = mod(t, v) |
|||
wend |
|||
return u |
|||
end sub |
|||
print "Greatest common divisor: ", gcd(12345, 9876)</lang> |
|||
=={{header|Z80 Assembly}}== |
=={{header|Z80 Assembly}}== |