Lời giải :
program hotrotinhoc ;
var a: array[1..32000] of integer;
i,n,j,max,tg : integer;
begin
write('n='); readln(n);
writeln('Nhap gia tri cua cac phan tu');
for i:= 1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
max:=a[1];
for i:=1 to n do
if a[i]>max then max:=a[i];
write('So lon nhat cua mang la :',max);
writeln;
for i:= 1 to n-1 do
for j:=1 to n do
if a[i]>a[j] then
begin
tg:=a[i];
a[i]:=a[j];
a[j]:=tg;
end;
writeln('Mang sau khi sap xep theo thu tu tang dan la :');
for i:= 1 to n do write(a[i]:6);
readln
end.