program AvgMinMax;
varn, number, min, max, sum: integer;
beginwrite('Enter the value of n: ');readln(n);
readln(number);min := number;max := number;sum := number;
for var i := 2 to n dobeginreadln(number);sum := sum + number;if number < min then min := number;if number > max then max := number;end;
writeln('Average of min and max: ', (min + max) / 2:0:2);
end.
program AvgMinMax;
var
n, number, min, max, sum: integer;
begin
write('Enter the value of n: ');
readln(n);
readln(number);
min := number;
max := number;
sum := number;
for var i := 2 to n do
begin
readln(number);
sum := sum + number;
if number < min then min := number;
if number > max then max := number;
end;
writeln('Average of min and max: ', (min + max) / 2:0:2);
end.