Uses crt; Var A:array[1..5000] of integer; n,i,max,min:integer; Begin Clrscr; Write(‘Nhap so ptu N= ‘); Readln(n); For i:=1 to n do Begin Write(‘Nhap a[‘,i,’] = ‘); Readln(A[i]); End; Min:=a[1]; Max:=a[1]; For i:= 2 to n do Begin If max<a[i] then max:=a[i]; If min>a[i] then min:=a[i]; End; Writeln(‘So lon nhat trong day la: ‘,max); Writeln(‘So nho nhat trong day la: ‘,min); Readln End.
program max_min;
uses crt;
var A:array[1..1000] of integer;
n,i,max,min:integer;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]);
end;
max:=A[1]; min:=A[1];
for i:=2 to n do
begin
if A[i]>max then max:=A[i];
if A[i]<min then min:=A[i];
end;
writeln(‘So lon nhat la: ‘,max);
writeln(‘So nho nhat la: ‘,min);
readln;
end.
Uses crt;
Var A:array[1..5000] of integer;
n,i,max,min:integer;
Begin
Clrscr;
Write(‘Nhap so ptu N= ‘); Readln(n);
For i:=1 to n do
Begin
Write(‘Nhap a[‘,i,’] = ‘); Readln(A[i]);
End;
Min:=a[1]; Max:=a[1];
For i:= 2 to n do
Begin
If max<a[i] then max:=a[i];
If min>a[i] then min:=a[i];
End;
Writeln(‘So lon nhat trong day la: ‘,max);
Writeln(‘So nho nhat trong day la: ‘,min);
Readln
End.