i want to write a function that takes two parameters. a number A, and a value B. i want it to return 1 if the Bth bit from the right in the number A is 1, and return a 0 if it is 0.
example: A = 34 and B = 4, 34 in binary is 00100010, and the 4th bit from the right is a 0. So the function should return 0.
i need to do this using the masking to find a bit method.
thanks.
Tags: