Câu 1:
program tinhtich;
uses crt;
var i,P:integer;
begin
clrscr;
P:=1; i:=1;
while i<5 do
begin
P:=P*i;
i:=i+1;
end;
write('Tich cac so nho hon 5 la: ',p);
readln;
end.
Câu 2:
program tinhtong;
uses crt;
var i,t:integer;
begin
clrscr;
t:=0; i:=1;
while i<=20 do
begin
if i mod 2=0 then t:=t+i;
i:=i+1;
end;
write('Tong cac so tu nhien chan tu 1 den 20 la: ',t);
readln;
end.
Câu 3:
progam tinhtich;
uses crt;
var t,i:integer;
begin
clrscr;
t:=1; i:=1;
while i<=10 do
begin
if i mod 2=1 then t:=t*i;
i:=i+1;
end;
write('Tich cac so tu nhien le tu 1 den 10 la: ',t);
readln;
end.