Set ArrayList exercise practice--score

Source: Internet
Author: User

Namespace set exercises to practise a practice
{
Class Program
{
static void Main (string[] args)
{
Console.WriteLine ("Please Enter your class number:");
int n = Convert.ToInt32 (Console.ReadLine ());
ArrayList al = new ArrayList ();
for (int i = 0; i < n; i++)
{
Console.WriteLine ("The" + (i+1) + "The results of the students are:");
Al. ADD (Convert.ToInt32 (Console.ReadLine ()));
}
for (int i = 0; i < al. Count; i++)
{
Console.WriteLine ("The students ' grades are" +al[i]+ ");
}
Double sum = 0;

for (int i = 0; i < n; i++)
{
sum = sum + convert.toint32 (al[i]);
}
Console.WriteLine ("The total score is" +sum+ ");
Al. Sort ();
for (int i = 0; i < al. Count; i++)
{
Console.WriteLine ("Students ' grades are arranged in a certain order as" + Al[i] + "points");
}
Double Ave = 0;
Ave = (Sum-convert.toint32 (al[0])-Convert.ToInt32 (Al[4])/(AL. COUNT-2);
Console.WriteLine ("The average of your class is divided into" +ave+ ");


Console.ReadLine ();
}
}
}

Set ArrayList exercise practice--score

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.