Euclid was a Greek mathematician who lived approximately 2,300 years ago. His algorithm for computing the greatest common divisor of two positive integers, a and b, is both efficient and recursive. It is outlined below:
Ifbis 0 then
Returna
Else
Setcequal to the remainder whenais divided byb
Return the greatest common divisor ofbandc
Write a program that implements Euclid’s algorithm and uses it to determine the greatest common divisor of two integers entered by the user.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here