Enter a score of 10 people to find the highest score, the lowest score, and the bubble sort.

Source: Internet
Author: User

  

             //Enter a score of 10 people to find the highest score, the lowest score, the average            int[] Fenshu =New int[Ten]; intMax =0; intMin =0; intsum =0;  for(inti =0; I <Ten; i++) {Fenshu[i]=int.                Parse (Console.ReadLine ()); Sum+=Fenshu[i]; if(i = =0) {Max=Fenshu[i]; Min=Fenshu[i]; }                Else                {                    if(Max <Fenshu[i]) {Max=Fenshu[i]; }                    if(Min >Fenshu[i]) {min=Fenshu[i]; }}} Console.WriteLine ("Maximum value:"+max); Console.WriteLine ("Minimum Value:"+min); Console.WriteLine ("Average score:"+ sum/Ten); //Enter the age of the class, sorted by age from big to smallConsole.Write ("Please enter the number of people:"); intn =int.            Parse (Console.ReadLine ()); int[] nianling =New int[n];  for(inti =0; I < n; i++) {Console.Write ("Please enter the age of the {0} individual:". II1); Nianling[i]=int.            Parse (Console.ReadLine ()); }            //Start Sorting             for(intj =0; J < N-1; J + +)            {                 for(inti = j+1; I < n; i++)                {                    if(Nianling[i] >Nianling[j]) {                        //equal substitution                        intZhong =Nianling[i]; Nianling[i]=Nianling[j]; NIANLING[J]=Zhong; }                }            }            foreach(intIinchnianling)            {Console.WriteLine (i); } console.readline ();

Enter a score of 10 people to find the highest score, the lowest score, and the bubble sort.

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.