Cod sursa(job #253430)

Utilizator butler1234Cioc Stefan butler1234 Data 5 februarie 2009 19:42:03
Problema Ciurul lui Eratosthenes Scor 0
Compilator fpc Status done
Runda Arhiva educationala Marime 0.45 kb
program ciur;
var a:array[1..100]of longint;
    n,i,s,j:longint;
    f1,f2:text;
    q:boolean;
begin
assign(f1,'ciur.in'); reset(f1);
assign(f2,'ciur.out'); rewrite(f2);
readln(f1,n);
s:=0;
for i:=1 to n do
   begin
   q:=true;
     for j:=2 to (i div 2) do
          begin
          if i mod j=0 then
            q:=false;
          end;
      if q=false then
        s:=s+1;
   end;
   s:=s-1;
write(f2,s);
close(f1);
close(f2);
end.