平均工资.c 229 B

123456789101112131415
  1. #include <stdio.h>
  2. int main() {
  3. int n, i;
  4. scanf("%d",&n);
  5. float salary[n], sum = 0.0;
  6. for (i = 0; i < n; i++) {
  7. scanf("%f", &salary[i]);
  8. sum += salary[i];
  9. }
  10. printf("%.2f",sum / n);
  11. return 0;
  12. }