Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const n=12;
- var a:array[1..n] of integer;
- k,i,j,p,x:integer;
- begin
- writeln('Исходный массив A:');
- for i:=1 to n do begin
- readln(a[i]);
- write(a[i]:4);
- end;
- writeln;
- for i:=2 to n do
- begin
- x:=a[i];
- j:=1;
- while x<a[j] do inc(j);
- for p:=i-1 downto j do
- a[p+1]:=a[p];
- a[j]:=x;
- end;
- writeln('Отсортированный массив:');
- for i:=1 to n do
- write(a[i]:4);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement