Câu 1:
program an_danh;
uses crt;
var n,i:integer;
begin
clrscr;
n:= 0;
for i:= 1 to 100 do
if i mod 3 = 0 then n:= n + 1;
write('So cac so la boi cua 3 la: ',n);
readln
end.
Câu 2:
program an_danh;
uses crt;
var n,i:integer;
begin
clrscr;
n:= 0;
for i:= -100 to 100 do
if i mod 2 = 0 then n:= n + 1;
write('Cac so chan pham vi tu -100 den 100 la: ',n);
readln
end.
Câu 3:
program an_danh;
uses crt;
var i:integer;
begin
clrscr;
for i:= 1 to 100 do
if i mod 5 = 0 then write(i,' ');
readln
end.
Bài 1:
uses crt;
var i,dem:integer;
begin
clrscr;
dem:=0;
for i:=1 to 100 do
if i mod 3=0 then inc(dem);
writeln('so boi cua 3 trong pham vi tu 1 den 100 la: ',dem);
readln;
end.
Bài 2:
uses crt;
var i,dem:integer;
begin
clrscr;
dem:=0;
for i:=-100 to 100 do
if i mod 2=0 then inc(dem);
writeln('so luong so chan trong pham vi tu -100 den 100 la: ',dem);
readln;
end.
Bài 3:
uses crt;
var i,dem:integer;
begin
clrscr;
dem:=0;
for i:=1 to 100 do
if i mod 5=0 then inc(dem);
writeln('so boi cua 5 trong pham vi tu 1 den 100 la: ',dem);
readln;
end.