Hai kawan, hari ini lg moodnya posting nih ,
kali ini, aku pengen share tentang coding pengurutan angka pada pascal
Silahkan dibaca* kawan ◦^⌣^◦
»» READMORE...
kali ini, aku pengen share tentang coding pengurutan angka pada pascal
Silahkan dibaca* kawan ◦^⌣^◦
------------------------------------------------------------------------------------------------------
program UAS;
uses crt;
var
a : array[1..100] of integer;
i, j, t, n : integer;
begin
clrscr;
write('Ketik Jumlah angka yang diinput = ');read(n);
writeln('==================================');
writeln;
for j := 1 to n do
begin
write('Masukkan nilai test ',j,' : ');
read (a[j]) ;
end;
for i := j-1 downto 1 do
for j := 1 to i do
if a[j] < a[j+1] then
begin
t := a[j];
a[j] := a [j+1];
a[j+1] := t;
end;
writeln;
writeln('Urut Data Terbesar ke kecil');
for j := 1 to n do
begin
write(a[j] : 3) ;
end;
readln;
readln;
end.
-------------------------------------------------------------------------------------------
program UAS;
uses crt;
var
a : array[1..100] of integer;
i, j, t, n : integer;
begin
clrscr;
write('Ketik Jumlah angka yang diinput = ');read(n);
writeln('==================================');
writeln;
for j := 1 to n do
begin
write('Masukkan nilai test ',j,' : ');
read (a[j]) ;
end;
for i := j-1 downto 1 do
for j := 1 to i do
if a[j] < a[j+1] then
begin
t := a[j];
a[j] := a [j+1];
a[j+1] := t;
end;
writeln;
writeln('Urut Data Terbesar ke kecil');
for j := 1 to n do
begin
write(a[j] : 3) ;
end;
readln;
readln;
end.
-------------------------------------------------------------------------------------------