Adapted by Neilor Tonin, URI Brazil
Read an undetermined number of pairs values M and N (stop when any of these values is less or equal to zero). For each pair, print the sequence from the smallest to the biggest (including both) and the sum of consecutive integers between them (including both).
The input file contains pairs of integer values M and N. The last line of the file contains a number zero or negative, or both.
For each pair of numbers, print the sequence from the smallest to the biggest and the sum of these values, as shown below.
Input Sample | Output Sample |
5 2 |
2 3 4 5 Sum=14 |