text: Sort 3 Integers without using if condition or using only max ( ) function | JavaScript program for the above approach ; Find maximum element ; Find minimum element ; Driver Code
code: function printSorted ( a , b , c ) { let get_max = Math . max ( a , Math . max ( b , c ) ) ; let get_min = - Math . max ( - a , Math . max ( - b , - c ) ) ; let get_mid = ( a + b + c ) - ( get_max + get_min ) ; document . write ( get_min + " " + get_mid + " " + get_max ) ; } let a = 4 , b = 1 , c = 9 ; printSorted ( a , b , c ) ;