Câu 1:
program tinh_tong;
uses crt;
var n,i,t:integer;
begin
clrscr;
write('Nhap n: '); readln(n);
i:=2; t:=0;
while i<=n do
begin
t:=t+i;
i:=i+2;
end;
write('Tong la: ',t);
readln;
end.
Câu 2:
program tong_chan;
uses crt;
var A:array[1..1000] of integer;
n,i,t:integer;
begin
clrcsr;
write('Nhap n: '); readln(n);
t:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(A[i]);
if A[i] mod 2=0 then t:=t+A[i];
end;
write('Tong cac phan tu chan la: ',t);
readln;
end.