Lesson #10. Minimum or Maximum value of N numbers
Task: n numbers are given ( n >= 0 is entered from the keyboard). Find minimum value of these numbers.
****************************************************************
Solution1. Let's assign the first entered number to min variable. Then in a loop check if the next entered number is less than min. If it is, so reassign this value to min:

What is not good: The first value is handled separately.
******************************************************************************
Solution2. Let's assign the maximum value of real type (real.MaxValue) to min variable. Then in a loop check if the first entered number is less than min. If it is, so reassign this value to min.
The idea is that after the first iteration min will be reassigned in any case because x < real.MaxValue:

✎
1. {0.3}[task-1-min.pas]. 5 numbers are entered. Output the maximum and minimum of the entered numbers.
E.g.:
5 3 8 1 2 => maximum is 8, minimum is 1
2. {0.5}[task-2-min.pas]. An integer N is given and a set of N rectangles defined by their sides (pairs of numbers a and b). Find the areas of all the rectangles and minimum area of them.
E.g.:
How many rectangles? 3 Please, enter the sides of the rectangles: 2 3 1 5 4 2 The minimum area of all rectangles is 5.
3. {0.5}[task-3-min.pas]. An integer N is given and a set of N rectangles defined by their sides (pairs of numbers a and b). Find the perimeters of all the rectangles and maximum perimeter of them.
E.g.:
How many rectangles? 3 Please, enter the sides of the rectangles: 2 3 1 5 4 2 The maximum perimeter of all rectangles is 12.
4. {0.3}[task-4-min.pas]. Find the minimum of 5 entered numbers and print its serial number (order).
E.g.:
5 3 8 1 2 => minimum is 1, its serial number is 4
5. {0.5}[task-5-min.pas]. Find the minimum and maximum of 10 entered numbers and print the sum of their serial numbers.
E.g.:
2 15 3 8 1 2 9 1 7 11 => max is 15, min is 1, 15 + 1 = 16
6. {0.5}[task-6-min.pas]. An integer N is given and a set of N numbers (entered from the keyboard). Find a serial number of the first minimum among the numbers and serial number of the last maximum among the numbers.
E.g.:
2 15 3 8 1 2 9 1 15 11 => serial numb of min is 5, serial numb of max is 9