#include
int iszhiShu(int num){
int count = 0,i;
for(i=1;i<=num;i++){
if(num%i==0){
count++;
}
}
if(count>=3){
return 0;
}else{
return 1;
}
}
void main(){
int numArr[100000],n,sum=0,temp=0,i;
double avg;
printf("请输入个数:");
scanf("%d",&n);
printf("\n");
for(i=0;i
scanf("%d",&numArr[i]);
if(iszhiShu(numArr[i])==1){
temp++;
sum+=numArr[i];
}
}
if(sum==0){
avg=0;
}else{
avg=sum*1.0/temp;
}
printf("这些数中,质数和是:%d,质数的平均数是:%.2lf.\n",sum,avg);
}