Question: Java Program. Please only answer if you understand the problem. Consider the problem of finding the Greatest Common Divisor (GCD) of two positive integers a
Java Program. Please only answer if you understand the problem.
Consider the problem of finding the Greatest Common Divisor (GCD) of two positive integers a and b. It can be mathematically proved that if b<=a
GCD(a, b) = b, if (a mod b) = 0;
GCD(a, b) = GCD(b, a mod b), if (a mod b) != 0.
Write a recursive function called GCD with signature public static int GCD(int a, int b) that returns the greatest common divisor of two positive integers a and b with b <= a.
Write a java program to test your function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
