Cod sursa(job #1086905)
Utilizator | Data | 18 ianuarie 2014 17:38:30 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 20 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
program ciur;
var f,g:text;
N,i,k:word;
function prim(nr:integer):boolean;
var i:byte;
begin
prim:=true;
for i:=2 to nr div 2 do
if nr mod i=0 then prim:=false;
end;
begin
assign(f,'ciur.in');
assign(g,'ciur.out');
reset(f);rewrite(g);
readln(f,N);
k:=0;
for i:=2 to N do
if prim(i) then inc(k);
write(g,k);
close(f);
close(g);
end.