const SIZE = 100; Var P : array [1..SIZE] of integer; N, tot, cn, i : integer; Begin Readln(n); For i:=1 to n do P[i] := 1; Tot := 0; For i:=2 to n do Begin If p[i] = 1 then Tot := tot + 1; Cn := i * 2; While cn <= n do Begin P[cn] := 0; Cn := cn + I; End; End; Writeln(tot); End.输入:30;
输出:1
