Find the number

0

0 votes
Mathematics, Math, Basic Math, mathematics, mathamatics, greatest common divisor, basic math
Problem

You are given two numbers a and b.

Task Determine the Nth number which is divisible by a and b.

Example

Assumptions

  • = 3
  • b= 2
  • N = 3

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:

  • a: Represents an integer denoting a
  • b: Represents an integer denoting b
  • N: Represents an integer denoting the Nth number that is to be found

Input format

Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).

  • The first line contains denoting the number of test cases. T also specifies the number of times you have to run the solve function on a different set of inputs.
  • For each test case:
    • The first line contains a, b, and N.

Output format

For each test case in a new line, print the Nth number.

Constraints

1t105

1a,b104

1N109

Code snippets (also called starter code/boilerplate code)

This question has code snippets for C, CPP, Java, and Python.

Sample Input
1
4 6 3
Sample Output
36
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

The numbers which are divisible by both 4 and 6 are 12,24,36,48..... and here the 3rd number is 36.

Contributers:
Editor Image

?