Consider all possible pairs and check their sums
for ( int i = 0 ; i < n ; i ++ ) for ( int j = i + 1 ; j < n ; j ++ ) if ( arr [ i ] + arr [ j ] == sum ) Console . Write ( " ( " + arr [ i ] + " , ▁ " + arr [ j ] + " ) " + " STRNEWLINE " ) ; }