text: Find average of two numbers using bit operation | Function to return the average of x and y using bit operations ; Calculate the average Floor value of ( x + y ) / 2 ; Driver code
code: def getAverage ( x , y ) : NEW_LINE INDENT avg = ( x & y ) + ( ( x ^ y ) >> 1 ) ; NEW_LINE return avg NEW_LINE DEDENT x = 10 NEW_LINE y = 9 NEW_LINE print ( getAverage ( x , y ) ) NEW_LINE