import java.util.Arrays;public class Hello { public static void main(String[] args){ Hello hello=new Hello(); int[] scores={89,-23,64,91,119,52,73}; System.out.println("考试成绩的前三名为:"); hello.score(scores); } public void score(int[] scores){ Arrays.sort(scores); int count=0; for(int i=scores.length-1;i>=0;i++){ if(scores[i]<0||scores[i]>100) continue; count++; if(count>3) break; System.out.println(scores[i]); } }}
添加回答
举报
0/150
提交
取消