Post Page Advertisement [Top]

python program

Write a program in python to find L C M of two number.

A program to find L C M of two number.

As we know that The least common multiple is the smallest positive integer that is divisible by both given numbers means for calculating it we LCM we nee to calculate lowest value which can divide the given values.

code:

x=int(input("Enter first number : "))
y=int(input("Enter another number : "))
large=x
if x>y:
     large=x
else:
     large=y
while 1:
     if large%x==0 and large%y==0:
          print("L C M Of ",x,"and",y,"is ",large)
          break
     else:
          large+=1


Thank-you


No comments:

Post a Comment

Bottom Ad [Post Page]