Program Pascal : Cek Tabel Terurut atau Tidak

Program cek_terurut;
uses wincrt;
type tabint = array[1..100]of integer;

function cek_depan_kecil(a:tabint; n:integer):boolean;
var i:integer;
    x:boolean;
begin
i:=1;
x:=true;
while x and (i<n) do
      begin
      if a[i]>=a[i+1] then x:=false
      else i:=i+1;
      end;
cek_depan_kecil := x;
end;

var T:tabint;
    i,n:integer;
    check:boolean;
begin
write('Masukan batas = ');readln(n);
for i:=1 to n do
    begin
    write(i,' = ');readln(T[i]);
    end;
check := cek_depan_kecil(T,n);
writeln(check);
end.

0 comments:

Komentar