Algorithm 1: gcd(a, b)
Input: Two integers a and b
Result: The greatest common divisor of a and b
if a > b then
return gcd(a - b, b)
else if a < b then
return gcd(a, b - a)
else
return a
Algorithm 2: gcd(a, b)
Input: Two integers a and b
Result: The greatest common divisor of a and b
if b = 0 then
return a
else
return gcd(b, a % b)
Algorithm 3: gcd(a, b)
Input: Two integers a and b
Result: The greatest common divisor of a and b
while b != 0 do
r = a % b
a = b
b = r
end
return a