Data Structures and Algorithms20775 marksFactorial, Fibonacci Sequence, GCD, Tower of Hanoi
Write a recursive program to find GCD of two numbers.
Write a recursive program to find GCD of two numbers. [5]
The GCD (Greatest Common Divisor) of two numbers is based on Euclid's Algorithm: - If b == 0, then GCD(a, b) = a - Otherwise, GCD(a, b) = GCD(b, a % b) This is a naturally recursive problem where each call reduces the problem size until the base case is reached. --- --- --- Input: a = 48, b = 18 ...