Target sum pairs problem

https://ide.codingblocks.com/s/66605 in my code only two test cases passed. please tell me the reason why two test cases not passed.

sort the array in ascending order as numbers should be written in increasing order.
for eg:- 1 and 4 should be the output not 4 and 1.