def hcf(x, y):
      """This function takes two
      integers and returns the H.C.F"""

      if x > y:
              smaller = y
      else:
              smaller = x

      for i in range(1,smaller + 1):
              if((x % i == 0) and (y % i == 0)):
                      hcf = i

      return hcf


# take input from the user
num1 = int("54")
num2 = int("24")

print("The H.C.F. of", num1,"and", num2,"is", hcf(num1, num2))
Вывод результата:
('The H.C.F. of', 54, 'and', 24, 'is', 6)


 Похожие публикации
2015-11-30 • Просмотров [ 235 ]