第二次实训作业

package classwork;
import java.util.*;

public class sore {

/**
 * @param args
 */
public static void main(String[] args) {
	// TODO Auto-generated method stub
	int StudentSore[];
	int i,Maxsore,Minsore;
	StudentSore = new int[4];
	Scanner Student = new Scanner(System.in);
	System.out.println("请输入四个学生的成绩:");
	for(i=0;i<4;i++){
		StudentSore[i] = Student.nextInt();
	
	}
	for(i=0;i<4;i++){
		System.out.println(StudentSore[i]);
	
	}
	for(i=3;i>-1;i--){
		System.out.println(StudentSore[i]);
			
	}
	for(i=0,Maxsore=StudentSore[0];i<4;i++){
		if(StudentSore[i]>Maxsore) Maxsore=StudentSore[i];
	}
	for(i=0,Minsore=StudentSore[0];i<4;i++){
		if(StudentSore[i]<Minsore) Minsore=StudentSore[i];
	}
	System.out.println("最高分为:"+Maxsore);
	System.out.println("最低分为:"+Minsore);
}

}

posted @ 2019-04-10 11:54  欧阳威oyw  阅读(95)  评论(0编辑  收藏  举报