Home > Back-end >  Help bosses
Help bosses

Time:09-25

Use of convicted prime function, complete all prime Numbers between 100 to 200 the average output,
# include
# include
Int main () {
int n;
Float s, t;
S=0.0, n=1, t=101.0;
While (t<198) s=s + t, t=t + 2.0; n++;
T=s/n.
Printf (" % f \ n ", s);
Return 0;
}
Result is 7301.000000, the bosses don't spray I...

CodePudding user response:

You this is not a prime number, number of courtship is
Prime is not divisible by 1 and itself outside of the other Numbers of
You can look at the code
 # include 
Int main ()
{
Int t, count=0, I, j;
Float sum=0;
For (I=100; i<=200; I++)
{
//determine primes
For (j=2; j{
If (I % j==0)
break;
The else
{
sum=sum+i;
count++;
}
}
}
Printf (" % f ", sum/count);
Return 0;
}
  • Related