Cod sursa(job #1251111)
| Utilizator | Data | 28 octombrie 2014 22:42:37 | |
|---|---|---|---|
| Problema | Ciurul lui Eratosthenes | Scor | 0 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
program pascal;
var i,j,x:integer;
n:longint;
v:array[2..1000] of boolean;
p,q:text;
begin
assign(p,'ciur.in');
reset(p);
assign(q,'ciur.out');
rewrite(q);
read(p,n);
for i:=2 to n do begin
if v[i]=false then begin
j:=i+i;
while j<= n do begin
v[j]:=true;
j:=j+1;
end;
end;
end;
x:=0;
for i:=2 to n do if v[i]=false then x:=x+1;
write(q,x);
close(p);
close(q);
end.