def lcm(x, y):
      """This function takes two
      integers and returns the L.C.M."""

      # choose the greater number
      if x > y:
              greater = x
      else:
              greater = y

      while(True):
              if((greater % x == 0) and (greater % y == 0)):
                      lcm = greater
                      break
              greater += 1

      return lcm


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

print("The L.C.M. of", num1,"and", num2,"is", lcm(num1, num2))
Вывод результата:
('The L.C.M. of', 54, 'and', 24, 'is', 216)

Оценка - 1.0 (19)

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