Binary & Bitwise Operators
- What is 2^5 in binary?
- What is 2^5 - 1 in binary?
- What is the general rule for binary numbers which are of the form 2^n or 2^n - 1?
- Implement a function that takes in an integer and prints out its two's complement value by following the algorithm described above. Hint: to invert the bits of a number you can use the "~" operator. For example ~25 will invert the bits of the integer 25.