LCM and GCD in c++