Sum of two numbers if the original ratio and new ratio obtained by adding a given number to each number is given | Function to return the sum of numbers which are in the ration a : b and after adding x to both the numbers the new ratio becomes c : d ; Driver code
def sum ( a , b , c , d , x ) : NEW_LINE INDENT ans = ( ( x * ( a + b ) * ( c - d ) ) / ( ( a * d ) - ( b * c ) ) ) ; NEW_LINE return ans ; NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT a , b , c , d , x = 1 , 2 , 9 , 13 , 5 ; NEW_LINE print ( sum ( a , b , c , d , x ) ) ; NEW_LINE DEDENT