Write a program that reads 5 integers, detects and prints the largest and smallest of them

const
n = 5;

var
a: array [1..n] of integer;
i, amax, amin: integer;

begin
randomize;
for i: = 1 to n do
begin
a [i]: = random (100) – 50;
write (a [i], ”);
end;
writeln;
amin: = a [1];
for i: = 2 to n do
if a [i] <amin then amin: = a [i];
amax: = amin;
for i: = 2 to n do
if a [i]> amax then amax: = a [i];
writeln (‘The maximum element is:’, amax, ‘.’);
writeln (‘The minimum element is:’, amin, ‘.’);
end.



One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.