x*y = a + b*lcm(x,y) + c*gcd(x,y)
I have to solve this eqaution.How to make a solution for it.
This is hardly a C++ question, it is maths. Anyway, obviously you have made the transform (x,y>0)
That allows you to create a quadratic equation in gcd(x,y), that gives you what you the condition on gcd. That immediately excludes solutions for a large set of a,b,c. [fractional and imaginary solutions are disallowed]. For those that do have solution, then you have one of two conditions to forefill, and that gives you only one iteration variable as x conditions y.
Note, that for a,b,c < 1e6 brute force is an appropriate tool as well (well just, it order 1e12 calculations and that is a bit difficult).