Ответ и Объяснение
var a:array [1..10] of integer;
max,min,i,temp:integer;
begin
randomize;
for i:=1 to 10 do
begin
a[i]:=random(50);
write (a[i],' ');
end;
writeln;
max:=1;
min:=1;
for i:=2 to 10 do
if a[i] > a[max] then max:=i else
if a[i] < min then min:=i;
writeln ('Max: ',a[max]);
writeln ('Min: ',a[min]);
temp:=a[min];
a[min]:=a[max];
a[max]:=temp;
for i:=1 to 10 do write (a[i],' ');
end.