Skip to content

Commit e9e3be4

Browse files
committed
lcm
1 parent be803ac commit e9e3be4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: Mathematics/lcm.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def GCD(a,b):
2+
if a == 0:
3+
return b
4+
return GCD(b%a, a)
5+
6+
def LCM(a, b):
7+
return int((a*b)/GCD(a,b))
8+
9+
10+
num1 = int(input("Enter the 1st num: "))
11+
num2 = int(input("Enter the 2nd num: "))
12+
print(f'LCM of {num1} and {num2} is {LCM(num1, num2)}')

0 commit comments

Comments
 (0)