uses crt; var a:array [1..100]of integer; n,i,j,k,x:integer; begin clrscr; randomize; write('n=');readln(n); writeln('Ishodnyj massiv:'); for i:=1 to n do begin a[i]:=random(200);; write(a[i],' '); end; writeln; for i:=2 to n do begin x:=a[i]; j:=1; while x>a[j] do inc(j); for k:=i-1 downto j do a[k+1]:= a[k]; a[j]:=x; end; writeln('Otsortirovannyj massiv:'); for i:=1 to n do write(a[i],' '); readln end.
uses crt;
var a:array [1..100]of integer;
n,i,j,k,x:integer;
begin
clrscr;
randomize;
write('n=');readln(n);
writeln('Ishodnyj massiv:');
for i:=1 to n do
begin
a[i]:=random(200);;
write(a[i],' ');
end;
writeln;
for i:=2 to n do
begin
x:=a[i];
j:=1;
while x>a[j] do inc(j);
for k:=i-1 downto j do a[k+1]:= a[k];
a[j]:=x;
end;
writeln('Otsortirovannyj massiv:');
for i:=1 to n do
write(a[i],' ');
readln
end.