Cod sursa(job #872387)
Utilizator | Data | 6 februarie 2013 00:20:36 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 30 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
Var f,g:text;
n,i,j,s:longint;
ok:boolean;
Begin
assign(f, 'ciur.in');reset(f);
assign(g, 'ciur.out');rewrite(g);
read(f, n);
for i:=2 to n do
begin
ok:=true;
for j:=2 to trunc(sqrt(i)) do
if i mod j=0 then ok:=false;
if ok=true then inc(s);
end;
write(g, s);
close(f);
close(g);
End.