Write a C++ program to Set Get Clear a particular bit in a given number

Write a C++ program to set a particular bit in a given number.

Output

Enter the Number: 4

Enter the Bit position you want to set(Between 0-31): 1

The Number after set the bit in the given position is: 6

Write a C program to get a particular bit in a given number.

 

Write a C++ program to clear a particular bit in a given number.

Output

Enter the Number: 4

Enter the Bit position you want to set(Between 0-31): 1

The Number after Clearing the bit in the given position is: 4

Write a C program to get a particular bit in a given number.

Output

Enter the Number: 4

Enter the Bit position you want to set(Between 0-31): 1

Given Position, bit is 0

Add a Comment