SaveText.Ru

Без имени
  1. var a:array[1..100] of integer; n,i,x,j,q:integer;
  2. begin
  3. read(n);
  4. for i:=1 to n do
  5. read(a[i]);
  6. for i:=2 to n do begin
  7. x:=a[i];
  8. j:=1;
  9. while (x>a[j]) do
  10. j:=j 1;
  11. for q:=i downto j 1 do
  12. a[q]:=a[q-1];
  13. a[j]:=x;
  14. end;
  15. for i:=1 to n do
  16. write(a[i],' ');
  17. end.
  18.  

Share with your friends:

Print