Main Menu

Deitel Exersices
Downloads
Contact ME


 


Back


Links
CE Main Site
Sharif University
Wikipedia
2Del
PHP
Javascript





    

In the name of GOD


Deitel Exercise : 3.45

(Recursive Greatest Common Divisor) The geatest common divisor of integers x and y is the largest integer that evenly divides both x and y. Write a recursive function GCD that returns the greatest common divisor of x and y, which is defines recursively as follows:

If y is equal to 0 then gcd(x, y) is x; otherwise, gcd(x, y) is gcd(x, x%y), where % is the modulus operator.