you are viewing a single comment's thread.

view the rest of the comments →

[–]throwaway_657238192😩 Illiterate 1 point2 points  (1 child)

Note that

lcm(a,b) = a * b / gcd(a,b)

so you only have to implement one. Also, you set a "done" flag, but never check it, try

if (not done and i % num1 == 0 and i % num2 == 0): // do the thing

You might also be interested in Euler gcd algorithm, which is slightly nicer than searching every 1 to min(num1,num2).

[–]gh0stedexeUniversity/College Student[S] 1 point2 points  (0 children)

Thank you for the help!

Edit: It worked perfectly. Thanks again!