function to check for the given sum in the array
static void printpairs ( int [ ] arr , int sum ) { HashSet < int > s = new HashSet < int > ( ) ; for ( int i = 0 ; i < arr . Length ; ++ i ) { int temp = sum - arr [ i ] ;