uses wincrt;
type tipelarik=array [1..100] of real;
var e,c,m:integer;
d:tipelarik;
procedure tukarkan(var a,b:real);
var t:real;
begin
t:=a;
a:=b;
b:=t;
end;
procedure bublesort(var a:tipelarik;n:integer);
var i,j: integer;
begin
for i:=1 to n-1 do
for j:=1 to n-i do
if a[j]>a[j+1] then tukarkan(a[j],a[j+1])
end;
begin
write('jumlah data=');
readln(m);
writeln('masukkan data=');
for e:=1 to m do
readln(d[e]);
writeln('data yang diurutkan=');
bublesort(d,m);
for c:=1 to m do
writeln(d[c]:0:0)
end.
0 komentar:
Posting Komentar