uses crt; var n,i,tc,tl:longint; a:array[1..1000]of longint; begin clrscr; write(‘n=’);readln(n); for i:=1 to n do begin read(a[i]); if a[i] mod 2=0 then inc(tc,a[i]) else inc(tl,a[i]); end; readln; writeln(‘Tong chan: ‘,tc,’; Tong le: ‘,tl); readln end.
program btsydn;
uses crt;
var A: array[1..500] of longint;
i, S1, S2, n: integer;
begin
clrscr;
write(‘Nhap n = ‘); readln(n);
for i:=1 to n do
begin
write(‘A[‘, i,’] = ‘); readln(A[i]);
end;
S1:=0; S2:=0;
for i:=1 to n do if A[i] mod 2 = 0 then S1:=S1+A[i] else S2:=S2+A[i];
writeln(‘Tong so chan = ‘, S1);
writeln(‘Tong so le = ‘, S2);
readln
end.
uses crt;
var n,i,tc,tl:longint; a:array[1..1000]of longint;
begin
clrscr;
write(‘n=’);readln(n);
for i:=1 to n do begin read(a[i]); if a[i] mod 2=0 then inc(tc,a[i]) else inc(tl,a[i]); end; readln;
writeln(‘Tong chan: ‘,tc,’; Tong le: ‘,tl);
readln
end.