Hello everyone!
I ask you to guide me what to do with the binary operations assignment.
Your program will receive two inputs:
- an integer number that represents a value;
- an integer number that represents bit position;
You program shall answer YES if there is a 1 in given position of the value. Otherwise, it
shall return NO.
Explanation: Your program receives 5 and 2. 5 is a value and 2 is a position. Lets write
number 5 in binary and show positions:
Binary 00000101
Position 76543210
So, we see that, for number 5, the position 0 is 1, position 1 is 0 and position 2 is 1. Therefore the answer is YES. If position was 1, then the response should be
NO.
Can you help please? I have no idea what to write.