Working out how to do it is a big part of the task: the idea is to get you thinking about how you go from a specification to a working design.
So start by thinking about how you would do it manually if you were looking for the "lowest pair" only.
You would add each pair is turn, comparing that sum with the "smallest so far". When you'd summed and compared them all, you would have the smallest pair.
So if the data was
3,4,2,1,5
Then the sums would be:
3,4,2,1,5
+
7 smallest becomes 7
+
6 smallest becomes 6
+
3 smallest becomes 3
+
6 smallest remains 3
And the smallest sum is
3
, the pair the generated it was
2 + 1
Easy, right?
Now think about how you would code that: you'd need a "smallestSum" variable, and a pair of "smallestInput" variables.
You'd want a loop, and inside the loop you would add the current pair, and compare the sum to
smallestSum
if the new sum is smaller, you'd store it in
smallestSum
and change the
smallestInput
values as well.
After the loop ended, you'd have the minimum.
So write the code to do that, and you are halfway finished. I'll leave the rest to you!