XOR Count Zero and One
Submissions: 728   Accuracy:


  Difficulty: Basic   Marks: 1

Given a number N, the task is to find XOR of count of 0s and count of 1s in binary representation of a given number.


The first line of the testcase contains an integer T, denoting number of testcases. The next T lines contains one integer N each.

Print XOR of count of 0s and 1s in binary representation of the given number in separate lines





Input  : 5
Output : 3
Binary representation : 101
Count of 0s = 1, 
Count of 1s = 2
1 XOR 2 = 3.

Input  : 7
Output : 3
Binary representation : 111
Count of 0s = 0
Count of 1s = 3
0 XOR 3 = 3.


** For More Input/Output Examples Use 'Expected Output' option **

Author: ShivamKD

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.