Euclid’s Algorithm to find GCD of two numbers
Euclid’s algorithm (or Euclidean algorithm) is a method for efficiently finding the greatest common divisor (GCD) of two numbers. The GCD of two integers, X
and Y
, is the largest number that divides both X
and Y
without leaving a remainder.