题解 | #统计成绩#
统计成绩
http://www.nowcoder.com/practice/cad8d946adf64ab3b17a555d68dc0bba
#include<stdio.h> int main(){ int n = 0; int i = 1; float higest = 0; float lowest = 0; float sum = 0; float score = 0; scanf("%d",&n); scanf("%f ",&score); lowest = score;//第一个当作参考 sum = score; while(i < n) { scanf("%f ",&score); if(score > higest) higest = score; if(score < lowest) lowest = score; sum +=score; i++; } printf("%.2f %.2f %.2f",higest,lowest,sum/(float)n); return 0; }