The gcd(m, n) can also be defined recursively as follows: If m % n is 0,
Question:
The gcd(m, n) can also be defined recursively as follows:
• If m % n is 0, gcd(m, n) is n.
• Otherwise, gcd(m, n) is gcd(n, m % n).
Write a recursive method to find the GCD. Write a test program that prompts the user to enter two integers and displays their GCD.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Question Posted: