{ read numbers to be sorted into the array }
repeat
Flag := true;
for I := 1 to N - 1 do
if (A[I] > A[I+1]) then
begin
Temp := A[I];
A[I] := A[I+1];
A[I+1] := Temp;
Flag := false;
end;
until (Flag)