Append two elements to make the array satisfy the given condition | Function to find the required numbers ; Find the sum and xor ; Prvar the required elements ; Driver code
function findNums ( arr , n ) { var S = 0 , X = 0 ; for ( i = 0 ; i < n ; i ++ ) { S += arr [ i ] ; X ^= arr [ i ] ; } document . write ( X + " " + ( X + S ) ) ; } var arr = [ 1 , 7 ] ; var n = arr . length ; findNums ( arr , n ) ;