Question: Write a well-commented C program that accepts an integer and n th position where the valid values on n is in between 0 and 31,
Write a well-commented C program that accepts an integer and nth position where the valid values on n is in between 0 and 31, both inclusive. The program then checks if the bit in the nth position is set or reset to represent the integer. If the bit in nth position is set (nth bit is 1), then it prints out nth bit is set otherwise, it prints out nth bit is not set.
For example, if the sample input is:
Enter the number: 101
Enter the position: 4
Sample output should be:
Bit in the 4th position is not set.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
