uses crt;
var a:array[1..100]of integer;
n,i,max,min,t,tc:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
writeln('Mang A gom cac phan tu la: ');
for i:=1 to n do
write(a[i]:4);
writeln;
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);
writeln('Cac phan tu le cua mang A la: ');
for i:=1 to n do
if a[i] mod 2<>0 then write(a[i]:4);
writeln;
writeln('Cac phan tu chan cua mang A la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('Tong cac phan tu cua mang A la: ',t);
tc:=0;
for i:=1 to n do
if a[i] mod 2=0 then tc:=tc+a[i];
writeln('Tong cac phan tu chan cua mang A la: ',tc);
readln;
end.