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