Program NN; Uses crt; Var A: array[1..10000] of longint; n,i,max,min: longint; Begin Clrscr; Write(‘Nhap n: ‘); Readln(n); For i:=1 to n do Read(A[i]); min:=A[1]; max:=A[1]; For i:=2 to n do Begin If A[i]<min then min:=A[i]; If A[i]>max then max:=A[i]; End; Writeln(‘Max = ‘,max); Write(‘Min = ‘,min); Readln End.
program ctpt;
uses crt;
var A: array[1..100] of integer;
i, x, max, min: integer;
begin
clrscr;
write(‘Nhap x = ‘); readln(x);
for i:=1 to n do
begin
write(‘A[‘, i, ‘] = ‘); readln(A[i]);
end;
max:=A[1];
for i:=2 to n do if max<A[i] then max:=A[i];
min:=A[1];
for i:=2 to n do if min>A[i] then min:=A[i];
writeln(‘GTLN = ‘, max);
wrlteln(‘GTNN = ‘, min);
readln
end.
Program NN;
Uses crt;
Var A: array[1..10000] of longint;
n,i,max,min: longint;
Begin
Clrscr;
Write(‘Nhap n: ‘); Readln(n);
For i:=1 to n do Read(A[i]);
min:=A[1]; max:=A[1];
For i:=2 to n do
Begin
If A[i]<min then min:=A[i];
If A[i]>max then max:=A[i];
End;
Writeln(‘Max = ‘,max);
Write(‘Min = ‘,min);
Readln
End.