【C】#KiKi求质数个数#
KiKi求质数个数
https://www.nowcoder.com/practice/d3a404ee0f8d41f98bf4707035d91086
#include <stdio.h> #include <math.h> int main() { int cnt = 0; for (int i = 101; i <= 999; i += 2) { int flag = 1; for (int j = 2; j <= sqrt(i); j++) { if (i % j == 0) { flag = 0; break; } } if (flag == 1) cnt++; } printf("%d", cnt); return 0; }