RosettaCodeData/Task/Greatest-common-divisor/GFA-Basic/greatest-common-divisor.basic
2023-07-01 13:44:08 -04:00

20 lines
242 B
Text

'
' 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