Update: The code is also available in Python in this entry
public long GCD(long numberA, long numberB) {
if (numberB==0)
return numberA;
else
return GCD(numberB, numberA % numberB);
}
Friday, July 3, 2009
Greatest Common Divisor (Recursion)
Here's a sample solution to solve the GCD recursively.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment