题解 | #统计成绩#
统计成绩
http://www.nowcoder.com/practice/cad8d946adf64ab3b17a555d68dc0bba
#include <stdio.h> int main() { int n = 0; float score[100] = { 0 }; //输入 scanf("%d", &n); float max = 0; float min = 100; float sum = 0; for (int i = 0; i < n; i++) { scanf("%f", &score[i]); sum += score[i]; if (score[i] > max) { max = score[i]; } if (score[i] < min) { min = score[i]; } } //输出 printf("%.2f %.2f %.2f\n", max, min, sum / n); return 0; }
编程初学者入门训练 文章被收录于专栏
针对编程初学者入门训练130题的代码详解专栏,内附注释方便理解,牛客130题的代码均用C语言实现,方便初学者学习。