Translate

Program Sorting Angka

Posted: Minggu, 08 Mei 2011 by Ajiex Estrada in Labels:
0

uses wincrt;
var angka:array [1..10] of integer;
i,j,n:byte;
x:integer;

begin
repeat
begin
inc(n);
write('isi bilangan bulat berhenti isi 999 ');readln(angka[n]);
end
until angka [n]=999 ;
dec(n);
writeln('sebelum diurutkan==> ');
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if angka[i]>angka[j]then
begin x:=angka[i];angka[i]:=angka[j];angka[j]:=x;end;
end;
end;
writeln;writeln('sesudah diurutkan');
for i:= 1 to n do write(angka[i]:5);
end.

0 comments: