Find the number which when added to the given ratio a : b , the ratio changes to c : d | Function to return the required number X ; Driver code
function getX ( a , b , c , d ) { var X = ( b * c - a * d ) / ( d - c ) ; return X ; } var a = 2 , b = 3 , c = 4 , d = 5 ; document . write ( getX ( a , b , c , d ) ) ;