program max_min;
uses wincrt;
var
bil:array[1..100] of integer;
terbesar :integer;
terkecil :integer;
i,n :integer;
begin
clrscr;
writeln;write(' Ada berapa bilangan =');readln(n);
for i:= 1 to n do
begin
write(' Bilangan ke ',i,' = ');readln(bil[i]);
end;
terbesar:=bil[1];
terkecil:=bil[1];
for i:= 2 to n do
if bil[i] > terbesar then
terbesar:=bil[i]
else
if bil[i] < terkecil then
terkecil:=bil[i];
writeln(' -----------------');
writeln(' Bilangan terkecil =',terkecil);
readln;
end.
0 Comment:
Posting Komentar