You will be prompted to enter a decimal value. The decimal value you entered will be assigned to the num variable. Let's assume that you have entered a value of 13. This value will be internally stored in the form of binary digits in the num variable as follows:
We will set a totbits variable to 32 bits because an int data type in C consists of 32 bits, and we have to mask each bit of the number in the num variable to display its binary version. We will define a mask variable and assign a value of 1 to it. To make the value 1 in the mask variable appear as 10000...00, that is, 1 followed by 31 zeros, we will left-shift ...