题解 | #记负均正II#
记负均正II
http://www.nowcoder.com/practice/64f6f222499c4c94b338e588592b6a62
include<stdio.h>
int main()
{
int n,count1=0,count2=0;
float average,total;
while(scanf("%d",&n)!=EOF)
{
if(n<0)
{
count1++;
}
if(n>0)
{
total+=n;
count2++;
}
}
if(count2==0) average=0.0;
else if(count2>0) average=total/count2;
printf("%d\n",count1);
printf("%.1f",average);
return 0;
}