纯C

这题不应该归为较难的把,属于简单的吧!

#include <stdio.h>
#include <string.h>

int main()
{
    int num, cnt1=0, cnt2=0, sum=0;
    while(scanf("%d",&num) != EOF)
    {
        if(num < 0)
        {
            cnt1++;
        }
        else
        {
            sum += num;
            cnt2++;
        }
    }
    float result =(cnt2>0)?((float) sum / cnt2):0;
    printf("%d\n%0.1f\n",cnt1,result);
    return 0;
}