Lời giải :
program hotrotinhoc ;
var a: array[1..32000] of integer ;
SLN,tong,i,n : 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;
SLN:=a[1]; tong:=0;
for i:= 1 to n do
begin
if SLN<a[i] then SLN:=a[i];
if a[i] mod 2=1 then writeln('Cac so le la :',a[i]);
if a[i] mod 2=0 then writeln('Cac so chan la :',a[i]);
tong:=tong+a[i];
end;
writeln('So lon nhat trong day la :',SLN);
write('Tong cua day so la :',tong);
readln
end.
uses crt;
var a:array[1..1000000]of longint;
i,n,ln,t:integer;
begin
clrscr;
write('nhap chieu dai day so='); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
{--------------xuat---------------}
for i:=1 to n do write(a[i]:4);
{-------------xuat-so-lon-nhat-------------}
writeln;
ln:=a[1];
for i:=1 to n do
if ln<a[i] then ln:=a[i];
writeln('so lon nhat la: ',ln);
{----------xuat-so-chan-so-le---------}
writeln;
writeln('cac so chan la: ');
for i:=1 to n do
if a[i] mod 2=0 then write(a[i]:4);
writeln;
writeln('cac so le la: ');
for i:=1 to n do
if a[i] mod 2=1 then write(a[i]:4);
{-------------tinh-tong-cua-day-so--------------}
writeln;
t:=0;
for i:=1 to n do
t:=t+a[i];
writeln('tong cua day so la: ',t);
readln;
end.