Bạn thử xem cách mình làm đc ko?
___________
uses crt;
var A:array[1..1000] of integer;
n,i,tc,tl,z,j,e,tic,til,dem,d,dc,dl:integer;
begin
clrscr;
Write('Nhap n: '); readln(n);
for i:=1 to n do
begin
Write('Nhap phan tu thu ',i,' :'); readln(A[i]);
end;
i:=1;
tc:=0;
tl:=0;
for d:=1 to n do if (A[d] mod 2=0) then dc:=dc+1 else dl:=dl+1;
if (dc<>0) then tic:=1 else tic:=0;
if (dl<>0) then til:=1 else til:=0;
for i:=1 to n do if (A[i] mod 2=0) then
begin
tc:=tc+A[i];
tic:=tic*A[i];
end
else
begin
tl:=tl+A[i];
til:=til*A[i];
end;
Writeln('Tong cac phan tu chan la: ' ,tc);
Writeln('Tich cac phan tu chan la: ' ,tic);
Writeln('Tong cac phan tu le la: ' ,tl);
Writeln('Tich cac phan tu le la: ' ,til);
for e:=1 to (n-1) do
for j:=e+1 to n do
if A[e]>A[j] Then
begin
z:=A[e]; A[e]:=A[j]; A[j]:=z;
end;
Writeln('Day sau khi duoc sap xep tang dan la: ');
for dem:=1 to n do Write(A[dem],' '); writeln;
writeln('Day sau khi duoc sap xep giam dan la: ');
for dem:=n downto 1 do write(A[dem],' ');
readln;
end.