Cod sursa(job #579376)
Utilizator | Data | 12 aprilie 2011 08:59:30 | |
---|---|---|---|
Problema | Ciurul lui Eratosthenes | Scor | 100 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
program ciur;
var n,i,count,j:longint;x:array[1..2000000] of boolean;f:text;
begin
assign(f,'ciur.in');
reset(f);
readln(f,n);
close(f);
for i:=2 to n do if x[i]=false then begin
j:=2;
while j*i<=n do begin
x[j*i]:=true;
j:=j+1;
end;
count:=count+1;
end;
assign(f,'ciur.out');
rewrite(f);
writeln(f,count);
close(f);
end.