Write a Python program to get the least common multiple (LCM)
I have used python 3.7 compiler for debugging purpose.
def lcm(a, b): if a > b: z = a else: z = b while(True): if((z % a == 0) and (z % b == 0)): lcm = z break z += 1 return lcm print(lcm(10, 20)) print(lcm(15, 17))
Result:
20
255
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used python 3.7 compiler for debugging purpose.
Result:
20
255
need an explanation for this answer? contact us directly to get an explanation for this answer