To convert a decimal number into a binary number by making use of a bitwise operator, perform the following steps:
- Enter a decimal number. This number is internally stored in the form of binary digits.
- Isolate the least significant bit of the decimal number by applying a logical AND operation between the entered decimal number and value 1.
- The least significant bit that results from step 2 is stored in an array.
- Right-shift the binary digits of the decimal number by 1 bit. On shifting to the right, the second least significant bit will become the least significant bit.
- Repeat steps 2 to 4 until all the binary digits of the decimal number are placed into the array.
- The binary digits assigned to the array are the binary version ...