#include <stdio.h> int main() { int sum = 0, num = 0, nnum = 0, temp; while (scanf("%d", &temp) != EOF) { if(temp >= 0) { sum += temp; num++; } else { nnum++; } } printf("%d\n%.1f", nnum, num == 0 ? 0:(float)sum/(float)num); return 0; }
#include <stdio.h> int main() { int sum = 0, num = 0, nnum = 0, temp; while (scanf("%d", &temp) != EOF) { if(temp >= 0) { sum += temp; num++; } else { nnum++; } } printf("%d\n%.1f", nnum, num == 0 ? 0:(float)sum/(float)num); return 0; }