Question: 3. In mathematics, the greatest common divisor (gcd), sometimes known as the greatest common factor (gcf) or highest common factor (hcf), of two non-zero integers,
3. In mathematics, the greatest common divisor (gcd), sometimes known as the greatest common factor (gcf) or highest common factor (hcf), of two non-zero integers, is the largest positive integer that divides both numbers. The greatest common divisor of a and b is written as gcd (a, b), or sometimes simply as (a, b) For example, gcd (12, 18)- 6, gcd (-4, 14) 2 and gcd (5, 0)-5. Two number are called co-prime or relatively prime if their greatest common divisor equals 1. For example, 9 and 28 are relative prime. Write a Java code to find/implement gcd (a, b) recursively
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
