You are given two numbers a and b.
Task Determine the Nth number which is divisible by a and b.
Example
Assumptions
Approach
You must find the Nth number which is divisible by a and b.
Here the answer is 18.
Function description
Complete the solve function provided in the editor. This function takes the following 3 parameters and returns the Nth number which is divisible by a and b:
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
Output format
For each test case in a new line, print the Nth number.
Constraints
1≤t≤105
1≤a,b≤104
1≤N≤109
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
The numbers which are divisible by both 4 and 6 are 12,24,36,48..... and here the 3rd number is 36.