Challenge: Euclidean Algorithm
The Euclidean algorithm is a technique used to compute the greatest common divisor (GCD) of two numbers, i.e., the largest number that divides both of them without leaving a remainder.
Given two integers
y, calculate the largest number that divides both of them without leaving a remainder.
An integer which will be
x = 1071
y = 462
result = 21
First, take a close look at this problem and design a step-by-step algorithm before jumping to the implementation. This problem is designed for your practice, so try to solve it on your own first. If you get stuck, you can always refer to the solution provided in the solution section. Good luck!