1:
a)
uses crt;
var i,n,t:integer;
begin
clrscr;
write('n='); readln(n);
t:=0;
for i:=1 to n do
if i mod 2=0 then t:=t+i;
writeln('Tong cac so chan la: ',t);
readln;
end.
b)
uses crt;
var i,t,n:integer;
begin
clrscr;
write('n='); readln(n);
t:=0; i:=1;
while i<=n do
begin
if i mod 2=0 then t:=t+i;
i:=i+1;
end;
writeln('tong cac so chan la: ',t);
readln;
end.
2:
a)
uses crt;
var i,n,t:longint;
begin
clrscr;
write('nhap n='); readln(n);
t:=1;
for i:=1 to n do
if i mod 2=0 then t:=t*i;
writeln('Tich cac so chan la: ',t);
readln;
end.
b)
uses crt;
var i,n,t:longint;
begin
clrscr;
write('n='); readln(n);
t:=1; i:=1;
while i<=n do
begin
if i mod 2=0 then t:=t*i;
i:=i+1;
end;
writeln('Tich cac so chan la: ',t);
readln;
end.