Bitwise OR ( | ) of all even number from 1 to N | Function to return the bitwise OR of all the even numbers upto N ; Initialize result as 2 ; Driver code
def bitwiseOrTillN ( n ) : NEW_LINE INDENT result = 2 ; NEW_LINE for i in range ( 4 , n + 1 , 2 ) : NEW_LINE INDENT result = result | i NEW_LINE DEDENT return result NEW_LINE DEDENT n = 10 ; NEW_LINE print ( bitwiseOrTillN ( n ) ) ; NEW_LINE