Question
To Print the LCM of two numbers.
Sample TestCaseExpected Output
Enter First number : 2 LCM is 4
Enter Second number : 4
Answer
a=int(input("Enter first number : "))
b=int(input("Enter second number : "))
if(a>b):
min1=a
else:
min1=b
while(1):
if(min1%a==0 and min1%b==0):
print("LCM is : ",min1)
break
min1+=1

No comments:
Post a Comment