0
how to compute lcm for more than 2 number ..like for 6 or more numbers in python??whats the problem with this code ?
n=int(input()) a=[] for i in range(n): x=int(input()) a.append(x) b=[] for l in a: t=max(a) for y in a: if t%y==0 and t!=y: a.remove(y) b.append(t) a.remove(t) ans=1 for j in b: ans=ans*j print(ans)
0 Answers