Hi Iftesham,
Such questions can be a bit tricky and difficult to solve if you can not pinpoint the logic behind the solution.
For this question per se, it was mentioned that x and y are integers; usually, we negate such information in the questions, try to solve the normal, and then, in the end, see if the answer we have gotten is consistent with the given information in the question.
While solving this question, you should have kept in mind that all the numbers need to be integers. This idea of unknown numbers necessarily being multiples of some numbers might be new to a lot of students, but this can help in solving a lot of difficult questions. Knowledge of such a method is what makes the performance in the actual exam go up by a lot.
I would suggest you keep a separate note of such novel concepts you might come across so that you can revise and go through them before you give mocks and the actual exam. And see in what questions can you use those techniques; this would be the only way to master sing these techniques.
Hope this helps!
Please feel free to ask any further questions you might have.
Regards