Sapiens 807 punti

Bubble sort

procedure bubblesort;
const
n = 20;
var
vett: array [1..20] of integer;
i,j,k,aux: integer;
begin
for j := n downto 2 do
for i := 1 to j-1 do
begin
if vett > vett[i+1] then
begin
aux := vett;
vett := vett[i+1];
vett[i+1] := aux;
end;
end;
for i:=1 to 20 do
begin
writeln(vett);
end;

end;

Registrati via email