Huawei on-machine test (passing fraction-java)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.