Advertisement
Racknoss

Bubble

May 23rd, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.38 KB | None | 0 0
  1. var
  2. z:boolean;
  3. a, b, d:integer;
  4. Mass: array[1..100] of integer;
  5. Begin
  6. b:=0;
  7. repeat
  8. b:=b+1;
  9. read(a);
  10. Mass[b]:=a;
  11. until(a=0);
  12. repeat
  13. z:=true;
  14. for a:= 1 to (b-1) do
  15.  begin
  16.  if (Mass[a]<Mass[a+1]) then
  17.   begin
  18.   d:=Mass[a];
  19.   Mass[a]:=Mass[a+1];
  20.   Mass[a+1]:=d;
  21.   z:=false;
  22.   end;
  23.  end;
  24. until(z=true);
  25. for a:= 1 to b do
  26.  begin
  27.  write(Mass[a]);
  28.  write(' ');
  29.  end;
  30. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement