Write a python function to find greatest common divisor


Topic: Write a python function to find greatest common divisor

Solution

def greatest_common_divisor(x,y):
    print("For", x, "and", y,"," ) 
    r=x%y
    while r>0:
        r=x%y
        if r ==0: 
            print("the greatest common divisor is", y,".")
        else:
            q=y
            x=q
            y=r
greatest_common_divisor(1071,1029)



List all Python Programs