I have written the below code to calculate the GCD and LCM.
It works fine for the given set of inputs in the question as well as for some other inputs which i tried.
If when running on codechef it says Wrong Answer.
Not sure what is causing this error.
Advise on what is wrong in the code.