Find Maximum and Minimum of two numbers using Absolute function | Function to return maximum among the two numbers ; Function to return minimum among the two numbers ; Driver code ; Displaying the maximum value ; Displaying the minimum value
function maximum ( x , y ) { return ( ( x + y + Math . abs ( x - y ) ) / 2 ) ; } function minimum ( x , y ) { return ( ( x + y - Math . abs ( x - y ) ) / 2 ) ; } let x = 99 , y = 18 ; document . write ( " " + maximum ( x , y ) + " " ) ; document . write ( " " + minimum ( x , y ) ) ;