Cod sursa(job #291393)
Utilizator | Data | 29 martie 2009 19:04:55 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | fpc | Status | done |
Runda | The Beginners | Marime | 0.35 kb |
var f:text; c,n,i,a,d:longint;
function prim(a:longint):boolean;begin
prim:=true;
for d:=2 to trunc(sqrt(a)) do
if a mod d=0 then prim:=false; end;
begin
assign(f,'ciur.in');reset(f);read(f,n);close(f);
c:=0;
for i:=2 to n do
if prim(i)=true then c:=c+1;
assign(f,'ciur.out');rewrite(f);write(f,c);close(f);end.