Q:

Writa a Python Program to Find G.C.D, using a function

0

Writa a Python Program to Find G.C.D, using a function

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

def hcf(n1,n2):
    if n2 != 0:
        return hcf(n2, n1 % n2)
    else:
        return n1

print("Enter two positive integers: ")
n1=int(input('Enter first integer: '))
n2=int(input('Enter second integer: '))
print("G.C.D of",n1," and ",n2," is ", hcf(n1, n2))

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now