#include <stdio.h>
int a[300],cnt=0;
double pjz1=0.0,pjz2=0.0;
int isP(int m)
{
int i;
for(i=2;i<m;i++)
if(m%i==0)return 0;
return 1;
}
jsValue()
{int i,s1,s2,cnt2;
for(i=0;i<300;i++)
{if(isP(a[i])==1)
{cnt=cnt+1;
s1=s1+a[i];}
if(isP(a[i])==0)
{cnt2=cnt2+1;
s2=s2+a[i];}
}
pjz1=s1/cnt;
pjz2=s2/cnt2;
return pjz1,pjz2,cnt;
}
readDat()
{
FILE *fp;
int i;
fp=fopen("in.dat","r");
for(i=0;i<300;i++)fscanf(fp,"%d",&a[i]);
fclose(fp);
}
writeDat()
{
FILE *fp;
fp=fopen("out.dat","w");
fprintf(fp,"%d\n%7.2f\n%7.2f\n",cnt,pjz1,pjz2);
fclose(fp);
}
main()
{
readDat();
jsValue();
writeDat();
printf("cnt=%d\n满足条件的平均值pzj1=%7.2f\n不满足条件的平均值pzj2=%7.2f\n",cnt,pjz1,pjz2);
}