All pastes #58618 Raw Edit

Miscellany

public text v1 · immutable
#58618 ·published 2006-05-24 12:00 UTC
rendered paste body
program stulpeliai;
   const N = 5;
   var i: integer;
   type Masyvas = array [1..N] of integer;
   procedure burbulas (var x: Masyvas);
      var a, j, k: integer;
          keitimas: boolean;
      begin
      k:=N;
      repeat
         keitimas := false;
         for j := 2 to k do
            if x[j-1] > x[j] then
               begin
                  a := x[j-1];
                  x[j-1] := x[j];
                  x[j] := a;
                  keitimas := true
               end;
            k := k - 1
            until not keitimas
        end;
begin
    i:=1;
    while i > 0 do begin
    readLn(i);
    burbulas(i);
    writeLn(burbulas(i));
    



end.