RosettaCodeData/Task/Greatest-common-divisor/Fantom/greatest-common-divisor.fantom
2023-07-01 13:44:08 -04:00

20 lines
250 B
Text

class Main
{
static Int gcd (Int a, Int b)
{
a = a.abs
b = b.abs
while (b > 0)
{
t := a
a = b
b = t % b
}
return a
}
public static Void main()
{
echo ("GCD of 51, 34 is: " + gcd(51, 34))
}
}