diff --git a/Math/LCM_of_two_numbers.py b/Math/LCM_of_two_numbers.py new file mode 100644 index 0000000..bcf324f --- /dev/null +++ b/Math/LCM_of_two_numbers.py @@ -0,0 +1,16 @@ +def LCM(a,b): + if a==1: + print("The LCM is ",b) + elif b==1: + print("The LCM is ",a) + else: + n = max(a,b) + for i in range (1,n+1): + if a%i==0 and b%i==0: + hcf = i + lcm = (a * b)/hcf + print("The LCM is ",lcm) + +a = int(input("Enter first number: ")) +b = int(input("Enter Second number: ")) +LCM(a,b) \ No newline at end of file