Cod sursa(job #170278)
Utilizator | Data | 2 aprilie 2008 16:36:42 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 20 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
var v:array[1..2000] of 0..1;
n,nr,i,j:longint;
f:text;
begin
assign(f,'ciur.in');reset(f);
readln(f,n); close(f);
for i:=2 to trunc(sqrt(n)) do
if v[i]=0 then
for j:=2 to n div i do v[i*j]:=1;
for i:=2 to n do
if v[i]=0 then inc(nr);
assign(f,'ciur.out');rewrite(f);
write(f,nr); close(f); end.