Find all possible pairs with given Bitwise OR and Bitwise XOR values | Function to find pairs with XOR equal to A and OR equal to B ; Iterate from 1 to B ; Check if ( i OR y ) is B ; Driver Code
function findPairs ( A , B ) { for ( let i = 1 ; i <= B ; i ++ ) { let y = A ^ i ; if ( y > 0 && ( i y ) == B ) { document . write ( i + " " + y + " " ) ; } } } let A = 8 , B = 10 ; findPairs ( A , B ) ;