Compute the minimum or maximum of two integers without branching | Function to find minimum of x and y ; Function to find maximum of x and y ; Driver program to test above functions
def min ( x , y ) : NEW_LINE INDENT return y ^ ( ( x ^ y ) & - ( x < y ) ) NEW_LINE DEDENT def max ( x , y ) : NEW_LINE INDENT return x ^ ( ( x ^ y ) & - ( x < y ) ) NEW_LINE DEDENT x = 15 NEW_LINE y = 6 NEW_LINE print ( " Minimum ▁ of " , x , " and " , y , " is " , end = " ▁ " ) NEW_LINE print ( min ( x , y ) ) NEW_LINE print ( " Maximum ▁ of " , x , " and " , y , " is " , end = " ▁ " ) NEW_LINE print ( max ( x , y ) ) NEW_LINE