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