Запишите полный текст программы. for i: = to n-1 do; begin imax: =i ; for j: =i+1 to n do if a[ j]> a[imax] then imax: =j; x: =a[i] ; a[i]; =a[imax]; a[imax]: =x ;
var i, imax, j, x: integer; a: array[1..n]of integer;
begin for i := 1 to n do a[i] := random(100); for i := 1 to n - 1 do begin imax := i; for j := i + 1 to n do if a[j] > a[imax] then imax := j; x := a[i]; a[i] := a[imax]; a[imax] := x; end;
n = 20;
var
i, imax, j, x: integer;
a: array[1..n]of integer;
begin
for i := 1 to n do
a[i] := random(100);
for i := 1 to n - 1 do
begin
imax := i;
for j := i + 1 to n do
if a[j] > a[imax] then
imax := j;
x := a[i];
a[i] := a[imax];
a[imax] := x;
end;
for i := 1 to n do
write(a[i],' ');
writeln();
writeln(imax);
end.