我只给你打出关键程序及解释
sum:=0;//个数记录在sum里
for i=1 to n do//枚举i
if (i mod 3 =2)and(i mod 5=3)and(i mod 7=2)//你的条件
then inc(sum);//满足条件则sum+1
write(sum);//输出
var
n,i,s:longint;
begin
read(n);
s:=0;
for i:=1 to n do
if (i mod 3=2)and(i mod 5=3)and(i mod 7=2) then s:=s+1;
writeln(s);
end.
var n:看你需要;
procedure init;
begin
readln(n);
end;
procedure pd;
var i,t:随你;
begin
for i:=1 to n do
if (3 mod i=2) and (5 mod i=3) and (7 mod i=2) then inc(t);
if t=0 then writeln(0)
else writeln(t);
end;
begin
init;
pd;
end.