program P1;usescrt;varmas : array[1..20] of integer;i,j,k : integer;tmp : string;begin
clrscr;
writeln('Start array: ');
for i := 1 to 20 do begin
mas[i] := random(100);
write(mas[i],' ');
end;
if mas[i] mod 2 = 0 then mas[i] := 0;
if mas[i] = 0 then begin
for j := 20 downto i do if mas[j] <> 0 then begin
k := mas[j]; mas[j] := mas[i]; mas[i] := k;
writeln(''); writeln('Result array: ');
for i := 1 to 20 do write(mas[i],' ');
readln(tmp); read(tmp);
end.
program P1;
uses
crt;
var
mas : array[1..20] of integer;
i,j,k : integer;
tmp : string;
begin
clrscr;
writeln('Start array: ');
for i := 1 to 20 do
begin
mas[i] := random(100);
write(mas[i],' ');
end;
for i := 1 to 20 do
begin
if mas[i] mod 2 = 0 then
mas[i] := 0;
end;
for i := 1 to 20 do
begin
if mas[i] = 0 then
begin
for j := 20 downto i do
if mas[j] <> 0 then
begin
k := mas[j];
mas[j] := mas[i];
mas[i] := k;
end;
end;
end;
writeln('');
writeln('Result array: ');
for i := 1 to 20 do
write(mas[i],' ');
readln(tmp);
read(tmp);
end.