MaksNew

Untitled

Dec 7th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.67 KB | None | 0 0
  1. program xxx;
  2.  
  3. var
  4.     Mas: array of integer;
  5.     Buf, i, j, size, f: integer;
  6.  
  7. Begin
  8.     Writeln('размер масива: ');
  9.     Readln(size);
  10.     SetLength(mas, size);
  11.     for i := 1 to size do
  12.     Begin
  13.         Writeln('Введите член ', i, '-ого значения => ');
  14.         Readln(mas[i]);
  15.     End;
  16.     for i := 2 to size do
  17.     Begin
  18.         Buf := mas[i];
  19.         j := i - 1;
  20.         while (j > 0) and (Buf < mas[j]) do
  21.         begin
  22.             mas[j + 1] := mas[j];
  23.             j := j - 1;
  24.         end;
  25.         mas[j + 1] := Buf;
  26.     end;
  27.     for i := 1 to size do
  28.         writeln('a[', i, ']=', mas[i], '  ');
  29.     readln
  30. End.
Advertisement
Add Comment
Please, Sign In to add comment