package s1java.sg.chap8;
import java.util.Arrays;
import java.util.Scanner;
public class HelloAccp5 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int [] score = new int[5];
int max;
Scanner sc = new Scanner(System.in);
System.out.println("请依次输入学生的成绩:");
for (int i = 0 ; i < score.length; i++){
System.out.print("第" + (i + 1) + "位学生的成绩是:");
score [i] = sc.nextInt();
}
max = score[1];
for (int in = 0 ; in < score.length; in++){
if(score[in] > max){
max = score[in];
}
}
System.out.println("显示最大值:" + max );
Arrays.sort(score);
System.out.println("学员成绩按升序排列:");
for (int i = 0 ; i < 5; i++){
System.out.println("第" + (i + 1) +"位学生的成绩是:" + score[i]);
}
}
}
在此基础上作修改!!