Cod sursa(job #361117)
Utilizator | Data | 3 noiembrie 2009 19:49:55 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | fpc | Status | done |
Runda | CNRV #4 | Marime | 0.31 kb |
var n,nr,i,j:longint;ok:boolean;f,g:text;
begin
assign(f,'ciur.in');reset(f);
assign(g,'ciur.out');rewrite(g);
read(f,n);nr:=0;
for i:=2 to n do begin
ok:=true;j:=2;
while (ok=true) and (j<=trunc(sqrt(i)))do begin
if i mod j=0 then ok:=false;
inc(j);end;
if ok then inc(nr);
end;
write(g,nr);close(g);
end.