Cod sursa(job #288550)

Utilizator gapdanPopescu George gapdan Data 25 martie 2009 21:47:01
Problema Ciurul lui Eratosthenes Scor 20
Compilator fpc Status done
Runda Arhiva educationala Marime 0.31 kb
var f,g:text;n,i,k,j,q:longint;
begin
assign(f,'ciur.in');reset(f);
assign(g,'ciur.out');rewrite(g);
readln(f,n);
q:=0;
for i:=2 to n do begin
k:=0;
for j:=2 to i div 2 do begin
if (i mod j=0)and(j<>i) then begin inc(k);break;end;
end;
if  k=0 then inc(q);
end;
write(g,q);
close(F);
close(g);
end.