Back to task list
Very common operation on sequence of values, or arrays is to find its extremal value - maximum or minimum. To achieve this one need to store current maximum (or minimum respectively) in a separate variable, and then run through array, comparing each of its elements to this variable. Whenever next value is greater than this temporary variable, this value should be copied into it (as a new maximum).
At the end of the pass this temporary variable will hold the extremum value.
As input data you will receive exactly 300 numbers. Find maximum and minimum among them and put them both as an answer, maximum first, minimum second - separated by space. For example:
input data: 1 3 5 7 9 11 ... 295 297 299 300 298 296 ... 12 10 8 6 4 2 answer: 300 1