求1-300中全部素数的平均值,请指正!
#include<stdio.h>int temp()
{ int number;
int i;
for(number=3;number<=300;number++){
for(i=2;i<number;i++){
if(number%i==0)
{return(number==0);} }
return (number);}
}
int fun()
{ int number;
int i;
int times=2;
for(number=3;number<=300;number++){
for(i=2;i<number;i++){
if(number%i==0)
{return(times==0);} }
times++;}
}
void main()
{
double average;
int temp();
int fun();
int total=3,times=2;
times+=fun();
total+=temp();
average=total/times;
printf("%lf",average);
}