Check if Sum and XOR of all elements of array is equal | Function to Check if Sum and XOR of all elements of array is equal ; Sum and XOR of all elements ; Checking Sum and XOR to be equal ; Driver Function ; Check Sum and XOR is equal
function equal_xor_sum ( arr , n ) { let Sum = 0 ; let Xor = 0 ; for ( let i = 0 ; i < n ; i ++ ) { Sum = Sum + arr [ i ] ; Xor = Xor ^ arr [ i ] ; } if ( Sum === Xor ) document . write ( " " ) ; else document . write ( " " ) ; } let arr = [ 6 , 3 , 7 , 10 ] ; let n = arr . length ; equal_xor_sum ( arr , n ) ;