#Jonathan Hudson #Student Number 12347890 #Date: 2020-08-26 #Lecture Practice # Compute the greatest common divisor of two integers # Compute the greatest common divisor of two integers # Parameters: # x, y: The integers for which the greatest common divisor is computed # Returns: The greatest common divisor of x and y def gcd(x, y): # Display a message each time that the factorial function is called so that # we can see the recursive calls as they occur print("Computing the gcd of", x, "and", y, "...") # Base case: x is evenly divisible by y if x % y == 0: return y # Recursive case: x is not evenly divisible by y else: return gcd(y, x % y) # Read two integers from the user and display their greatest common divisor a = int(input("Enter a positive integer: ")) b = int(input("Enter another positive integer: ")) print("The gcd of", a, "and", b, "is", gcd(a, b))