{pengurutan acd dengan nilai maxs}
uses wincrt;
var
i,j,n,imaks,k,temp,maks:integer;
data:array [1..100] of integer;
begin
write('masukkan banyak data:');readln(n);
for i := 1 to n do
begin
write('data',i,'=');readln(data[i]);
end;
for k := n downto 2 do
begin
imaks := 1;
maks:=data[1];
for j := 2 to k do
begin
if data[j] > maks then
imaks := j;
maks:=data[j];
end;
temp:=data[k];
data[k]:=maks;
data[imaks]:= temp;
end;
for i := 1 to n do
begin
writeln(data[i]);
end;
readln;
donewincrt;
end.
skip to main |
skip to sidebar
--
My Clock
Link Situ Kesukaan
Archives
About Me
Followers
Pengunjung Online
Shoutmix
Trafik
-
-
Editing by uliantony.co.cc
1 komentar: Algoritma_pengurutan
March 30, 2009 at 9:55 PM
Post a Comment