What is LCM-
LCM stands for lowest common multiple
Example -
let we have a two number 10 and 12 then common multiple of these two number is 60,120,180,....
but lowest one is 60,
so we can conclude that LCM of 10 and 12 is 60
LCM of 2,4 and 5 is 20
LCM of 10,12 and 13 is 780
Program -
def check(l,n):
for i in l:
if n%i!=0:
return 0
return 1
print("Enter numbers to find the LCM")
l=list(map(int,input().split()))
m=max(l)
while(1):
if check(l,m):
print("LCM is - "+str(m))
break
m=m+1
Enter numbers to find the LCM
10 12 13 20
LCM is - 780
Enter numbers to find the LCM
3 4 1 6 7
LCM is - 84