int gcd(int a, int b)
if (a==0 && b==0) return -1;
if (b==0) return a;
int lcm (int a, int b)
return (int) (a*b)/gcd(a,b);
Posted by: Nutan
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
There should not be any Spelling Mistakes.
There should not be any Gramatical Errors.
Answers must not contain any bad words.
Answers should not be the repeat of same answer, already approved.
Answer should be complete in itself.