## Python 3 Script to Find GCD or HCF of two Numbers by Euclid’s Algorithm Using Recursion Full Project For Beginners Welcome folks today in this blog post we will be `finding gcd or hcf of two numbers by euclid's algorithm using recursion` in python. All the full source code of the application is shown below.

# Get Started

In order to get started you need to make an `app.py` file and copy paste the following code

`app.py`

``````# defining gcd function
def gcd(num1,num2):
if num1%num2 == 0:
# Base case
return num2
else:
# Iterative case
return gcd(num2,num1%num2)

# taking first number
num1 = int(input("Enter first number: "))
# taking second number
num2 = int(input("Enter second number: "))

# checking if num2 is greater than num1 then swap these numbers
if num2 > num1:
(num1,num2) = (num2,num1)

# printing GCD
print("The GCD of the numbers is",gcd(num1,num2))``````

See also  Python 3 Tkinter Shopping Cart Management System Using MySQL Database GUI Desktop App Full Project For Beginners

Now if you execute the `python` script by typing the below command as shown below

`python app.py` 