Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
Added LCM of 2 numbers in Python
Browse files Browse the repository at this point in the history
  • Loading branch information
JeeBoomBoi committed Oct 9, 2019
1 parent e411d58 commit d5849ce
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Python/LCMoftwonumbers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def lcm(x, y):
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


num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
print("The L.C.M. of", num1,"and", num2,"is", lcm(num1, num2))

0 comments on commit d5849ce

Please sign in to comment.