Cod sursa(job #1538499)

Utilizator Vlad_CernoutanVlad Cernoutan Vlad_Cernoutan Data 29 noiembrie 2015 11:30:40
Problema Ciurul lui Eratosthenes Scor 20
Compilator fpc Status done
Runda Arhiva educationala Marime 0.44 kb
Program Ciur;

 var n, i, k1, k2, j : integer;
     fi, fo : text;
begin
 assign(fi, 'ciur.in');
 assign(fo, 'ciur.out');
 reset(fi);
 rewrite(fo);
 readln(fi, n);
 k2:=0;
 for i:=1 to n do begin
                   j:=i;
                   k1:=0;
                   for j:=1 to i do if abs(i mod j)=0 then inc(k1);
                   if k1=2 then inc(k2);
                  end;
 writeln(fo, k2);
 writeln(fo);
 close(fo);
end.