program average_of_extremes;
var
x: array [1..12] of integer;
i, max, min, sum: integer;
begin
randomize;
max := -25;
min := 25;
sum := 0;
for i := 1 to 12 do
x[i] := random(51) - 25;
if x[i] > max then max := x[i];
if x[i] < min then min := x[i];
end;
sum := max + min;
writeln(sum div 2);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
program average_of_extremes;
var
x: array [1..12] of integer;
i, max, min, sum: integer;
begin
randomize;
max := -25;
min := 25;
sum := 0;
for i := 1 to 12 do
begin
x[i] := random(51) - 25;
if x[i] > max then max := x[i];
if x[i] < min then min := x[i];
end;
sum := max + min;
writeln(sum div 2);
end.