Program maxmin; const N = 50; var arr : array [1..N] of integer; i : integer; min, max : real; begin Writeln('Массив: '); Randomize; for i := 1 to N do begin arr[i] := random(100); write(arr[i], ' '); end; max := arr[1]; min := arr[1]; for i := 1 to N do begin if min > arr[i] then min := arr[i]; if max < arr[i] then max := arr[i]; end; Writeln('Сумма = ', min+max); end.
const N = 50;
var
arr : array [1..N] of integer;
i : integer;
min, max : real;
begin
Writeln('Массив: ');
Randomize;
for i := 1 to N do
begin
arr[i] := random(100);
write(arr[i], ' ');
end;
max := arr[1]; min := arr[1];
for i := 1 to N do
begin
if min > arr[i] then min := arr[i];
if max < arr[i] then max := arr[i];
end;
Writeln('Сумма = ', min+max);
end.