r/shittyprogramming • • Sep 14 '18

Beginning in C++

I'm working in a small homework and the last step is calculate the least common multiple but with easy steps like if or something like that, could someone help me?

14 Upvotes

24 comments sorted by

View all comments

Show parent comment

1

u/hydrocyanide Sep 14 '18 edited Sep 14 '18

You need to solve greatest common divisor with a recursive function which only requires two if statements, then least common multiple is trivial once you've solved gcd.