var
a:array[1..20]of integer;
i,s,j:integer;
begin
randomize;
for i:=1 to 20 do begin
a[i]:=random(50)-25;
write(a[i]:4);
end;
writeln;
for i:=2 to 20 do begin
j:=i;
while a[j]>a[j-1] do begin
s:=a[j];
a[j]:=a[j-1];
a[j-1]:=s;
dec(j);
if j=1 then break;
for i:=1 to 20 do write(a[i]:4);
readln;
end.
var
a:array[1..20]of integer;
i,s,j:integer;
begin
randomize;
for i:=1 to 20 do begin
a[i]:=random(50)-25;
write(a[i]:4);
end;
writeln;
for i:=2 to 20 do begin
j:=i;
while a[j]>a[j-1] do begin
s:=a[j];
a[j]:=a[j-1];
a[j-1]:=s;
dec(j);
if j=1 then break;
end;
end;
for i:=1 to 20 do write(a[i]:4);
readln;
end.