Tham khảo:
program Tinh;
uses crt;
var i,n: integer; s,t: longint; ch: char;
a : array [1..100] of longint;
begin
repeat
clrscr; readln(n); s:=0; t:=0;
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
if odd(a[i])=True then s:=s+a[i] else t:=t+a[i];
end;
writeln('Tong cac so chan : ',t);
writeln('Tong cac so le : ',s);
writeln('Tiep tuc ! (C/K) ');
ch:=readkey;
until upcase(ch)='K'
end.
uses crt;
var n,i,t:integer;
begin
clrscr;
readln(n);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
writeln(t);
readln;
end.