Cod sursa(job #1135443)

Utilizator Alex1199Alex Bercea Alex1199 Data 7 martie 2014 21:16:20
Problema Ciurul lui Eratosthenes Scor 20
Compilator fpc Status done
Runda Arhiva educationala Marime 0.71 kb
program curul_e;
  Var f, g : text;
         i, n : longword;
         k:longint;
Begin
  Assign(f, 'ciur.in' );
   Reset(f);
   Read(f, n);
   if n<8 then
           if n<6  then
               if n<4 then
                   if n<3 then
                           k:=1
                           else
                           k:=2
                        else
                           k:=3
                   else
                   k:=4
            else
            k:=4;
     fOr i:=2 to n do
        if (i mod 2<>0) and (i mod 3<>0) and (i mod 5<>0) and  (i mod 7<>0) then
               k:=k+1;
   Close(f);


  Assign(g, 'ciur.out') ;
   Rewrite(g);
   Write(g,k);
  Close(G);
End.