primes.c (228B)
1 int is_prime(int n) { 2 if (n < 2) 3 return 0; 4 for (int i = 2; i*i <= n; i++) 5 if (n % i == 0) 6 return 0; 7 return 1; 8 } 9 10 int count(int n) { 11 int count = 0; 12 for (int i = 0; i < n; i++) 13 count += is_prime(i); 14 return count; 15 }