Sử dụng For.. do:
Var i,S:integer;
Begin
For i:= 1 to 100 do If i mod 2 = 0 then S:= S+i;
Writeln(' tong cac so chan :',S);
Readln;
end.
Sử dụng While ..do:
Var i,S:integer;
Begin
i:=0;
While i<=100 do If i mod 2 = 0 then S:= S+i;
Writeln(' tong cac so chan :',S);
Readln;
end.