Write a Python program to implement the Euclidean algorithm to find the greatest common…
- User
Write a Python program to implement the Euclidean algorithm to find the greatest common divisor (GCD) of three given numbers. Your program should prompt the user to enter three integers and display the GCD of the three numbers. Use the following steps to find the GCD of three numbers;
Assistant
code# Enter numbers a = int(input("Enter first integer: ")) b = int(input("Enter second integer: ")) c = int(input("Enter third integer: ")) # Find the maximum of three numbers if a > b and a > c: x = a elif b > a and b > c: x = b else: x = c # Start from the higher number and reduce it by one until it reaches 1 while(x!=1): if x%a == 0: y = a elif x%b == 0: y = b else: y = c x = y # Print the greatest common divisor print("GCD of",a,",",b,"and",c,"is",y)