Computer Science, asked by gocool807, 10 months ago

Write a program to input two numbers m and n and display first m multiple of n

Answers

Answered by fiercespartan
0

Reading this question, one would think it is hard. That is because the way this is written confuses the reader. We are basically asked to write a program to find the LCM of two numbers.

To find LCM in python, we basically multiply the two numbers and divide it by the HCF of the two numbers.

To find the HCF, we will import a module from math.

from math import gcd

Now, let's write the code:

m = int(input('Enter the first number:'))

n = int(input('Enter the second number:'))

print('The LCM is:' ,(m*n)/gcd(m,n))

Hope it helps! :)

Similar questions