PS: Oneself write, self test OK, for everybody reference.
/*
Description: 10 students after the final exam marking is completed, a teacher needs to draw a pass line, the requirements are as follows:
(1) The passing line is a multiple of 10;
(2) To ensure that at least 60% of the students pass;
(3) If all students are above 60 points, the pass line is 60 points
Input: Enter 10 integers, value 0~100
Output: Output pass line, multiples of 10
Input Sample: 61 51 49 3020 10 70 80 90 99
Output Sample: 50
*/
ImportJava.util.Scanner; Public classPassscore {Static intN = 10; Public Static voidMain (string[] args) {System.out.println ("Enter" +n+ "integer, take value 0~100, open with empty, enter End"); Scanner s=NewScanner (system.in); String Str=S.nextline (); String[] Strarray= Str.split (""); int[] Mark =New int[N]; S.close (); for(inti = 0; i < N; i++) {Mark[i]=Integer.parseint (Strarray[i]); System.out.println (Mark[i]); } sort (mark, N); if(Mark[0] >= 60) {System.out.println ("Pass line is: 60 points!" "); } Else{System.out.println ("Pass line is:" +mark[4]/10*10+ "points"); } } Private Static int[] Sort (int[] Mark,intLen) { inttemp = 0; for(inti = 0; i < Len; i++) { for(intj = i+1; J < Len; J + +) { if(Mark[i] >Mark[j]) {Temp=Mark[i]; Mark[i]=Mark[j]; MARK[J]=temp; } } } returnMark; }}
Huawei on-machine test (passing fraction-java)