Input: A = 10, Lcm = 10, Hcf = 50. Output: B = 50 Input: A = 5, Lcm = 25, Hcf = 4. Output: B = 20
A * B = LCM * HCF
B = (LCM * HCF)/A
Example : A = 15, B = 12
HCF = 3, LCM = 60
We can see that 3 * 60 = 15 * 12.
How does this formula work?
Since HCF divides both the numbers, let.
A = HCF * x
B = HCF * y
Note that x and y are not common factors, so LCM must include HCF, x and y.
So we can conclude.
LCM = HCF * x * y
So LCM * HCF = HCF * x * y * HCF which is equal to A * B
Below is the implementation of the above approach:
B = 1
- Find minimum number to be divided to make a number a perfect square
- Given number of matches played, find number of teams in tournament
- Find the largest good number in the divisors of given number N
- Find the total number of composite factor for a given number
- Find the maximum number of composite summands of a number
- Find the number of jumps to reach X in the number line from zero
- Find the smallest number whose digits multiply to a given number n
- Find the number of integers x in range (1,N) for which x and x+1 have same number of divisors
- Find count of digits in a number that divide the number
- Find the number of ways to divide number into four parts such that a = c and b = d
- Find maximum number that can be formed using digits of a given number
- Find if a number is divisible by every number in a list
- Find M-th number whose repeated sum of digits of a number is N
- Find n'th number in a number system with only 3 and 4
- Find n-th Fortunate Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.