how to compute lcm for more than 2 number ..like for 6 or more numbers in python??whats the problem with this code ? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
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)

20th Jun 2020, 5:29 AM
mahsa
mahsa - avatar
0 ответов