for ... do
program Tinh_S;
uses crt;
var i,n:byte;
S:longint;
begin
writeln('Nhap so n='); readln(n);
S:=0;
for i:=1 to n do
if i mod 2=1 then S:=S+i;
writeln('Tong cac so le nho hon hoac bang n la, S=',S)
readln
end.
* While....do
Uses crt;
var n,i,k: integer;
begin clrscr;
readln(n);
i:=0;
while(i<=n) do begin
i:=i+1;
if(i mod 2<>0) then k:=k+i;
end;
writeln(k);
readln;
end.
* for...do
Uses crt;
var n,i,u: integer;
begin clrscr;
readln(n);
for i:=1 to n do if(i mod 2<>0) then u:=u+i;
writeln(u);
readln;
end.
while... do
program Tinh_P;
uses crt;
var i,n:byte;
P:longint;
begin
writeln('Nhap so n='); readln(n);
P:=0; i:=1;
while i<=n do
begin
if i mod 2=1 then P:=P+i;
i:=i+1;
end;
writeln('Tong so le nho hon hoac bang n la, P=',P);
readln
end.