Program Sortir

Program Penggunaan_Array_Untuk_Sortir_Buble_Sort;
Uses Crt;
Var
nil1 : Array[1..100] of Integer;
n,i,j,dum : Integer;
Begin
ClrScr;
Write(‘mau isi berapa data acak (integer) =’); readln(n);
For i := 1 to n Do
Begin
Write(‘Data Ke ‘,i,’:’);Readln(nil1[i]);
End;
Program Penggunaan_Array_Untuk_Sortir_Buble_Sort;
Uses Crt;
Var
nil1 : Array[1..100] of Integer;
n,i,j,dum : Integer;
Begin
ClrScr;
Write(‘mau isi berapa data acak (integer) =’); readln(n);
For i := 1 to n Do
Begin
Write(‘Data Ke ‘,i,’:’);Readln(nil1[i]);
End;
{* penyapuan proses}
for i:= 1 to n-1 do
begin
for j:= i to n do
begin
if nil1[j]
begin
dum:=nil1[j];
nil1[j]:=nil1[i];
nil1[i]:=dum;
end;
end;
end;
writeln;
writeln(‘Hasil Sortir’);
for i := 1 to n do
write(nil1[i]:3);
readln;
end.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: