program phuongt; uses crt; var A: array[1..500] of integer; n, i, x, y: integer; begin clrscr; write(‘Nhap n = ‘); readln(n); for i:=1 to n do begin write(‘A[‘, i, ‘] = ‘); readln(A[i]); end; x:=0; y:=0; for i:=1 to n do begin if A[i] mod 2 = 0 then x:=x+A[i] else y:=y+A[i]; end; writeln(‘Tong so chan: ‘, x); writeln(‘Tong so le: ‘, y); readln end.
program Mang;
uses CRT;
var a: array[1..10000] of integer;
i,n,le,chan: integer;
begin
clrscr;
write(‘Nhap n= ‘); readln(n);
for i:=1 to n do
begin
write(‘a[‘,i,‘]: ‘);readln(a[i]);
end;
for i:=1 to n do
If a[i] mod 2 = 0 then chan:=chan+a[i]
else le:=le+a[i];
writeln(‘Tong so chan la: ‘,chan);
write(‘Tong so le la: ‘,le);
readln;
end.
program phuongt;
uses crt;
var A: array[1..500] of integer;
n, i, x, y: integer;
begin
clrscr;
write(‘Nhap n = ‘); readln(n);
for i:=1 to n do
begin
write(‘A[‘, i, ‘] = ‘); readln(A[i]);
end;
x:=0; y:=0;
for i:=1 to n do
begin
if A[i] mod 2 = 0 then x:=x+A[i] else
y:=y+A[i];
end;
writeln(‘Tong so chan: ‘, x);
writeln(‘Tong so le: ‘, y);
readln
end.