Cod sursa(job #291399)

Utilizator katamashCatalin Tamas katamash Data 29 martie 2009 19:12:17
Problema Ciurul lui Eratosthenes Scor 30
Compilator fpc Status done
Runda The Beginners Marime 0.31 kb
var f:text; j,c,n,i,d:0..2000000; 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.