Cod sursa(job #1980743)

Utilizator _Victor_Victor Ciobanu _Victor_ Data 13 mai 2017 21:59:11
Problema Ciurul lui Eratosthenes Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.44 kb
Program Ciur;
var A:array[1..2000000] of boolean;
n,i,j,s,v,p:0..2000000;
f,g: text;
begin
{assign(f,'ciur.in');
assign(g,'ciur.out');
reset(f);
rewrite(g); }
readln({f,}n);
for i:=1 to n do
 A[i]:= true;
i:= 2;
while i<=n do begin
//p:=i*i;
if A[i] = true then begin
 j:=1;
 while i*j <= n do begin
  A[i*j]:= false;
  j:= j + 1;
  end;
 s:=s+1;
 end;
i:= i+1;
end;
writeln({g,}s);
readln;
{close(f);
close(g);}
end.