package hello;import java.util.Scanner;import java.util.Arrays;public class Hello { public static void main(String[] args) { Scanner input=new Scanner(System.in); System.out.println("请输入考试成绩"); int[] scores=new int[7]; for(int i=0;i<7;i++){ int b=input.nextInt(); scores[i]=b; } System.out.println("考试成绩前三名为:"); Arrays.sort(scores); int num=0; for(int i=scores.length-1;i>=0;i--){ if(scores[i]<0||scores[i]>100){ continue; } num++; if(num>3){ break; } System.out.println(scores[i]); }} // TODO Auto-generated method stub }
添加回答
举报
0/150
提交
取消