program ct; uses crt; var i,n,s:integer; A:array[1..100] of integer; begin clrscr; write(‘nhap n:=’);readln(n); for i:=1 to n do begin write(‘nhap mang A[‘,i,’]:=’);readln(A[i]); end; for i:=1 to n do if A[i] mod 2=0 then writeln(‘cac so chan la:’,A[i]); s:=0; for i:=1 to n do if A[i] mod 2=1 then s:=s+A[i]; writeln(‘tong cac so le la:’,s); readln end.
program ct;
uses crt;
var i,n,s:integer;
A:array[1..100] of integer;
begin clrscr;
write(‘nhap n:=’);readln(n);
for i:=1 to n do
begin
write(‘nhap mang A[‘,i,’]:=’);readln(A[i]);
end:
for i:=1 to n do
if A[i] mod 2=0 then writeln(‘cac so chan la:’,A[i]);
s:=0;
for i:=1 to n do if A[i] mod 2=1 then s:=s+A[i];
writeln(‘tong cac so le la:’,s);
readln
end.
Var a:array[1..200] of integer;
i,n,s:integer;
begin
write('Nhap so luong phan tu n = ');readln(n);
for i:=1 to n do
begin
write('Nhap phan tu thu ',i,' = ');readln(a[i]);
end;
for i:=1 to n do
if a[i] mod 2 = 0 then s:=s+a[i];
write('tong cac so chan la ',s);
readln;
end.