Find unique no.(algo++)

#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[10]={1,5,3,4,7,5,2,4,2,1};
int res=0;
for(int i=0;i<10;i++)
{
res=res^a[i];
}
cout<<res;
int num=0;
for(int i=0;i<10;i++)
{
if(res&a[i]>0)
{
num=num^a[i];
}
}
cout<<"no 1 is "<<num<<endl;
cout<<“no 2 is”<<num^res;

}
this code is not produing output

The logic which you have used for finding the second number is not correct. Check out my code and tell me if you are able to understand it -

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.