RosettaCodeData/Task/Greatest-common-divisor/Fantom/greatest-common-divisor.fantom
Ingy döt Net db842d013d A-M baby
2013-04-10 21:29:02 -07: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))
}
}