bạn tham khảo
uses crt;
var a:array[1..200]of integer;
i,n,t:integer;
begin
clrscr;
write('Nhap n='); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if a[i] mod 2=0 then t:=t+a[i];
writeln(t);
readln;
end.
var a:array[1..200] of integer;
i,n,dem1,dem2:integer;
begin
write('Nhap n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
end;
dem1:=0;
dem2:=0;
for i:=1 to n do
begin
if i = n then write(a[i])
else write(a[i],' ');
if a[i] mod 2 = 0 then dem1:=dem1+1
else dem2:=dem2+1;
end;
writeln('So cac phan tu chan la ',dem1);
write('So cac phan tu le la ',dem2);
readln;
end.