Martin and XOR(help me to understand and solve below q in cpp)

Martin is given an assignment from his teacher about XOR operations but He is unable to solve the assignment.
So, He asked you for your help. The problem goes like :
You are given a list of integers and you are supposed to find the number of pairs with odd XOR value.
Help Martin solving this problem
Input Format

First line contains a single integer T, denoting the number of test cases.
Each test case contains two lines, first line contains a single integer N denoting the size of the list and the last line contains N space separated integers.
Constraints

1<=T<=100
1<=N<=1000
1<=Arr[i]<=1000
Output Format

For each test case print the number of pairs whose XOR is odd.
Sample Input

1
1 2 4

Sample Output

2


my soln but it don’t work

Hello @Kash-Moulik-3715574511847721 what you have not understood in the above?

https://ide.codingblocks.com/s/396369 pls have a look on my code , why it is not working

Hello @Kash-Moulik-3715574511847721 please wait i have to go through the question .
till then could you please explain me your logic and implementation.

You have to count the pairs whose XOR is odd, while in your code you just check for if the number is odd or even and finally multiply it. Sol - You can run a nested loop to iterate over all pairs in the array and check if the XOR of that pair is odd, if it is, simply add it to the total count of answer.

@gopal2676 are you TA and if you are TA then also you are not allowed to respond on thread until it is not in your portal.

okay, I didn’t know that. Sorry

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.