uses crt;
var a:array[1..100]of integer;
n,i,max,min,tb,t,tam,j:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
max:=a[1];
min:=a[1];
for i:=1 to n do
begin
if max<a[i] then max:=a[i];
if min>a[i] then min:=a[i];
end;
writeln('Gia tri lon nhat la: ',max);
writeln('Gia tri nho nhat la: ',min);
tb:=0;
for i:=1 to n do
tb:=tb+a[i];
writeln('Gia tri trung binh la: ',tb/n:4:2);
writeln('Tong cua day so la: ',tb);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
writeln('Tong cac so chan trong khoang tu 1 toi ',n,' la: ',t);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]>a[j] then
begin
tam:=a[i];
a[i]:=a[j];
a[j]:=tam;
end;
writeln('Day so sau khi sap xep tang dan la: ');
for i:=1 to n do
write(a[i]:4);
readln;
end.