Sum of XOR of sum of all pairs in an array | C # program to find XOR of pair sums . ; Driver code
using System ; class GFG { static int xorPairSum ( int [ ] ar , int n ) { int sum = 0 ; for ( int i = 0 ; i < n ; i ++ ) sum = sum ^ ar [ i ] ; return 2 * sum ; } static public void Main ( String [ ] args ) { int [ ] arr = { 1 , 2 , 3 } ; int n = arr . Length ; Console . WriteLine ( xorPairSum ( arr , n ) ) ; } }