Const n = 5; var a: array [1..n] of integer; i,l,m,k: integer; begin for i := 1 to n do read(a[i]); l := 1; while l < n do begin while (a[l] mod 2 = 0) and (l < n) do l := l + 1; if l < n then begin k := l; m := a[l]; for i := l+1 to n do if a[i] mod 2 <> 0 then if a[i] > m then begin m := a[i]; k := i end; a[k] := a[l]; a[l] := m; l := l + 1 end; end; for i := 1 to n do write(a[i],' ') end.
var
a: array [1..n] of integer;
i,l,m,k: integer;
begin
for i := 1 to n do read(a[i]);
l := 1;
while l < n do
begin
while (a[l] mod 2 = 0) and (l < n) do l := l + 1;
if l < n then
begin
k := l;
m := a[l];
for i := l+1 to n do
if a[i] mod 2 <> 0 then
if a[i] > m then
begin
m := a[i];
k := i
end;
a[k] := a[l];
a[l] := m;
l := l + 1
end;
end;
for i := 1 to n do write(a[i],' ')
end.