Array target sum

The output your code is giving is not in proper order, so either sort the array before finding the pairs or after finding pairs, print them in sorted order., anyway can be chosen.