LanQiaoTestCodes/成绩分析.java

46 lines
949 B
Java
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package LanQiaoOJ;
import java.util.Scanner;
/*
* 题目描述
小蓝给学生们组织了一场考试卷面总分为100分每个
学生的得分都是一个0到100的整数。
请计算这次考试的最高分、最低分和平均分。
输入描述
输入的第一行包含一个整数n(1≤n≤104),表示考试
人数。
接下来行每行包含一个0至100的整数表示一个学
生的得分。
输出描述
输出三行。
第一行包含一个整数,表示最高分。
第二行包含一个整数,表示最低分。
第三行包含一个实数,四舍五入保留正好两位小数,表示平均分。*/
public class 成绩分析 {
static int [] a =new int [10000];
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
double s=sc.nextInt();
int sum=0,max=0,min=110;
for(int i=0;i<s;i++) {
a[i]=sc.nextInt();
if(a[i]>max) {
max=a[i];
}
if(a[i]<min) {
min=a[i];
}
sum=sum+a[i];
}
double ave=sum/s;
System.out.println(max);
System.out.println(min);
System.out.printf("%.2f",ave);
}
}