题解 | #KiKi求质数个数#
KiKi求质数个数
https://www.nowcoder.com/practice/d3a404ee0f8d41f98bf4707035d91086
#include <math.h> #include <stdio.h> int main() { int count = 0; for (int i = 101; i <= 997; i += 2) { int j = 2; for (j = 3; j <= sqrt(i); j++) { if (i % j == 0) { break; } } if ((j * j) > i) { count++; } } printf("%d", count); return 0; }