Rizq Technology – Exploring Your iDea.

All about My Experiences, Knowledge and Thoughts.

Sorting @pacsal

uses wincrt;
const
L: array [1..6] of integer = (07, 08, 01, 02, 04, 10);
pass:integer= 0;
nilai_diingat: integer = 0;
i:integer= 0;
label 1;

begin
for pass:= 1 to 5 do begin
nilai_diingat:= L[pass+1];
writeln(‘Nilai di ingat=’, nilai_dingat);

for i:=pass downto 1 do begin
writeln(‘test’);
if nilai_diingat< L[i] then begin
writeln(‘Sebelum digeser ‘, ‘L[i+1]=’, L[i+1], ‘ ‘, ‘L[i]=’, L[i]);
L[i+1]:=L[i];
writeln(‘Sesudah digeser ‘, ‘L[i+1]=’, L[i+1], ‘ ‘, ‘L[i]=’, L[i]);
L[i+1]:=L[i];
end else begin
{posisi sudah benar keluar dari loop}
L[i+1]:=nilai_diingat;
goto 1;
end;
end;
1:
end;
for i:=1 to 6 do begin
writeln(L[i]);
end;

end.

Categories: Pascal