#Credits to NPTEL MOOC, Programming, Data Structures & Algorithms in 
#Python by Madhavan Mukund, Chennai Mathematical Insti
tute 
 

def gcd(m,n):
    if m < n:
        (m,n) = (n,m)
    if (m%n) == 0:
        return(n)
    else:
        diff = m-n
        return(gcd(max(n,diff),min(n,diff)))

Source link

Greatest common divisor program using euclids algorithms

Leave a Reply

Your email address will not be published. Required fields are marked *