I need help figuring out how to implement the function described below. Thank you. /*** Returns the greatest common divisor of integers x and y. The greatest* common divisor can be determined by the recursive function as follows:** Case 1: gcd(x, y) = gcd(x-y, y) where x > y* Case 2: gcd(x, y) = gcd(x, y-x) where x* Case 3: gcd(x, y) = x = y where x == y* Case 4 (Edge case): gcd(x, y) = {x if y == 0 or y if x == 0}** This method must be computed recursively! Failure to do so will result* in zero credit for this method.** For the purposes of this assignment, do not worry about* handling negative numbers. Throw an IllegalArgumentException* if either x or y is negative.**@paramxThe first integer*@paramyThe second integer*@throwsIllegalArgumentException if either x or y is negative*@returnThe greatest common divisor of x and y*/
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here