Cod sursa(job #227258)

Utilizator TamasionutzIoan-Cornel Tamas Tamasionutz Data 3 decembrie 2008 23:21:42
Problema Ciurul lui Eratosthenes Scor 20
Compilator fpc Status done
Runda Arhiva educationala Marime 0.56 kb
{ Ciurul lui Eratosthenes }

var f:text;
    i,n,k:integer;

begin
        Assign(f,'ciur.in'); reset(f);
        Read(f,n); close(f);
        Assign(f,'ciur.out'); rewrite(f);
        k:=0;
        For i:=2 to n do
                begin
                  If i=2 then Inc(k);
                  If i=3 then Inc(k);
                  If i=5 then Inc(k);
                  if i=7 then Inc(k);
                  if (i mod 2 <> 0) and (i mod 3 <> 0) and (i mod 5 <> 0) and (i mod 7<>0) then Inc(k);
                end;
        write(f,k);
        close(f);
end.