Euclidean Algorithm

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Number theory

Euclidean algorithm

Submitted by:
Medishetty yashwanth(2020btechcse108)

Submitted to:
Manushi guptha

Institute of engineering and technology


Jk lakshmipat university
January 2023
Aim: To find the gcd of two numbers using Euclid’s algorithm.

Programming code:

def GCDEuclidsAlgo(x,y):
if y == 0:
return x
else:
return GCDEuclidsAlgo(y,x%y)
a = int(input("a:"))
b = int(input("b:"))
print("GCD of",a,"&",b,"=",GCDEuclidsAlgo(a,b))

Result:

You might also like