uses crt;
type data=array[1..100] of integer;
var
i,n,j:integer;
a:data;
procedure bubble;
var temp:integer;
begin
for i:=1 to n-1 do
begin
for j:=n downto i+1 do
begin
if a[j] < a[j-1] then
begin
temp:=a[j];
a[j]:=a[j-1];
a[j-1]:=temp;
end;
end;
end;
end;
begin
clrscr;
write('masukkan banyak data: '); readln(n);
writeln;
for i:=1 to n do
begin
write('data ke-',i,' : '); readln(a[i]);
end;
writeln('*************************');
for i:=1 to n do
begin
write(a[i],' ');
end;
writeln;
bubble;
writeln('-------------------------');
write('Data Urut: ');
for j:=1 to n do
write(a[j],' ');
readln;
end.