Home > Back-end >  Don't know where your code has a problem, ask bosses to help have a look.
Don't know where your code has a problem, ask bosses to help have a look.

Time:04-18


 # include & lt; stdio.h> 

Int is_prime (int n)
{
For (int j=2; J * j & lt;=n; J++)
{
If (n % j==0)
{
return 0;
}
}
return 1;
}

Int main (void)
{
Int n, m, I, s=0, a=0;

The scanf (" % d % d ", & amp; N, & amp; M);

For (I=2; I & lt;=200; I++)
{
If (is_prime (I))
{
S++;
If (s & gt;=n & amp; & S & lt;=m)
{
A +=I;
}
}
If (s & gt;=m)
break;
}

Printf (" % d ", a);
return 0;
}


To China university mooc submitted above, five cases only by a new one, but I run once, result is no problem ah, don't know where your code has a problem, ask bosses to help have a look,

CodePudding user response:

The meaning of the 200 is the 200th prime, it's not really 200 this value,
  • Related