Description:
- Read a number from the user. Check number of set bits in a given number. If number of set bits is odd, then Bit parity is odd. Similarly, If number of set bits is even, then Bit parity is even.
- For example, If num = 7, number of set bits = 3 which is odd number, so bit parity is odd. Similarly, if num = 3, number of set bits = 2, bit parity should be even
Sample Execution:
Test Case 1:
Enter the number : 7
Number of set bits = 3
Bit parity is Odd
Test Case 2:
Enter the number : 15
Number of set bits = 4
Bit parity is Even
Test Case 3:
Enter the number : 6
Number of set bits = 2
Bit parity is Even
452