Array target sum

https://ide.codingblocks.com/s/48295 what wrong with code two test cases pass either two fail

Hey Neeraj, you are supposed to print the output in sorted order. For eg.
input:
5
5
2
3
4
1
6
your code’s output:
5 and 1
2 and 4
but correct output is :
1 and 5
2 and 4