Skip to main content

Python program to calculate highest common factor of two numbers

 

def cal_hcf(a, b):
  if b == 0:
    return abs(a)
  else:
    return cal_hcf(b, cal_mod(a, b))

print(cal_hcf(25, 9)) # output will be : 3

Comments