const n=11; var i,j,max,t:integer; a:array[1..n]of integer; begin writeln('Определение массива..'); for i:=1 to n do begin write('Введите a[',i,']: '); readln(a[i]) end; max:=1; if n>1 then for i:=2 to n do if a[max]<a[i] then begin max:=i; end; writeln(max); for j:=1 to max-1 do for i:=1 to max-j do if a[i] > a[i+1] then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; end; for j:=max+1 to n-1 do for i:=max+1 to n-j do if a[i] < a[i+1] then begin t:=a[i]; a[i]:=a[i+1]; a[i+1]:=t; end; writeln('Измененный массив:'); for i:=1 to n do writeln('a[',i,']: ',a[i]); readln; end. |