--

Algoritma_pengurutan

Monday, March 30, 2009 mencoba sebuah karya dunia maya
{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.

1 komentar: Algoritma_pengurutan

mencoba sebuah karya dunia maya said...
March 30, 2009 at 9:55 PM
This comment has been removed by the author.

Post a Comment