program a;
uses crt;
var A:array[1..1000] of integer;
i,n,S,S1,S2:integer;
begin clrscr;
writeln('Nhap so phan tu n: '); readln(n);
for i:=1 downto n do
begin
writeln('A[',i,']'); readln (A[i]);
end;
S:=0; S1:=0; S2:=0;
for i:=1 downto n do
S:=S+A[i];
writeln('Tong mang do la: ',S);
for i:=1 downto n do
begin
if A[i] mod 2=0 then writeln('Cac phan tu chan la: ',A[i])
S1:=S1+A[i];
end;
writeln('Tong cac phan tu chan la: ',S);
for i:=1 downto n do
begin
if A[i] mod 2<>0 then writeln('Cac phan tu le la: ',A[i]);
S2:=S2+A[i];
end;
writeln('Tong cac phan tu le la: ',S);
readln;
end.
Học tốt!