请问这道c语言题目怎么写?

2024-12-26 10:09:55
推荐回答(1个)
回答1:

#include void main(){ int n, temp, m = 0; float res = 0; scanf("%d", &n); for (int i = 0; i n; i++) { scanf("%d", &temp); if (temp > 0) { res += temp; m++; } } if (m) res = res / m; printf("%.2f\n", res);}