#includeint main(){ int i, sum=0, n=0; double p; for(i=1; i<100; i++) if(i%3==0){ sum+=i; n++; } p=(double)sum/n; printf("和为%d,平均值为%lf\n",sum,p); return 0;}
程序结果如下: