Greatest common divisor: Difference between revisions
added GFA Basic example
m (→version 1: changed the comments in the REXX section header.) |
(added GFA Basic example) |
||
Line 1,215:
v = tmp
u</lang>
=={{header|GFA Basic}}==
<lang basic>
'
' Greatest Common Divisor
'
a%=24
b%=112
PRINT "GCD of ";a%;" and ";b%;" is ";@gcd(a%,b%)
'
' Function computes gcd
'
FUNCTION gcd(a%,b%)
LOCAL t%
'
WHILE b%<>0
t%=a%
a%=b%
b%=t% MOD b%
WEND
'
RETURN ABS(a%)
ENDFUNC
</lang>
=={{header|GML}}==
|