info@meritcampus.com    +91-85006-22255
...
`

Write a program to find the two numbers. The difference of those two numbers and the ratio of larger number by smaller number is given.

Input (Integer, Integer) Output (String)
12, 5 `LargerNumber = 15.0, SmallerNumber = 3.0Difference = 15.0 - 3.0 = 12.0Ratio = 15.0/3.0 = 5.0  `
7, 3 LargerNumber = 10.5, SmallerNumber = 3.5
17, 6 LargerNumber = 20.4, SmallerNumber = 3.4
18, 4 LargerNumber = 24.0, SmallerNumber = 6.0
46, 8 LargerNumber = 52.57142857142857, SmallerNumber = 6.571428571428571

``` class FindNumbersFromDifferenceAndRatio {     public static void main(String s[])    {        System.out.println(findNumbers(30, 4));    }     public static String findNumbers(int difference, double ratioOfLargerBySmaller) { ```
```     } } ```
Topic:

### User comments below.All of them might not be correct.

To get the smallest number,logic is
smaller_number = (difference)/(ratioOflargerBySmaller-1)
larger_number = difference + smaller_number

Posted by Shashanka Mogaliraju    2015-03-16 09:20:57

Smaller number =difference /(ratio-1).   & larger number is difference+smaller number

Posted by Mohd Ajsam    2015-03-16 11:12:30