Check whether K | PHP program to check if k - th bit of a given number is set or not using right shift operator . ; Driver code
def isKthBitSet ( n , k ) : NEW_LINE INDENT if ( ( n >> ( k - 1 ) ) and 1 ) : NEW_LINE INDENT print ( " SET " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " NOT ▁ SET " ) NEW_LINE DEDENT DEDENT n , k = 5 , 1 NEW_LINE isKthBitSet ( n , k ) NEW_LINE