Pagini recente » Cod sursa (job #2171842) | Cod sursa (job #926168) | Cod sursa (job #1791951) | Cod sursa (job #2435658) | Cod sursa (job #227258)
Cod sursa(job #227258)
{ Ciurul lui Eratosthenes }
var f:text;
i,n,k:integer;
begin
Assign(f,'ciur.in'); reset(f);
Read(f,n); close(f);
Assign(f,'ciur.out'); rewrite(f);
k:=0;
For i:=2 to n do
begin
If i=2 then Inc(k);
If i=3 then Inc(k);
If i=5 then Inc(k);
if i=7 then Inc(k);
if (i mod 2 <> 0) and (i mod 3 <> 0) and (i mod 5 <> 0) and (i mod 7<>0) then Inc(k);
end;
write(f,k);
close(f);
end.