Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8988357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:59:57+00:00 2026-06-15T21:59:57+00:00

So, like the title says I need to pull the min and max values

  • 0

So, like the title says I need to pull the min and max values from an array I’ve created that utilizes a random number generator to fill it. I get the feeling it’s probably the Math class of operators that I need to use (IE, the math.floor and math.ceiling) but if that’s so I’m not quite sure how to utilize them with the array. I suppose the bottom line is that I don’t quite understand how arrays work, even though I’ve already done a couple of assignments utilizing them. Here’s what I have so far (I have to display all values in the listbox and give average and min/max for this assignment)

 private void button1_Click(object sender, EventArgs e)
    {
    int SIZE = 10;
    int[] nummers = new int[SIZE];
    Random rand = new Random();
    int total = 0;

    for (int index = 0; index < nummers.Length; index++)
    {
        nummers[index] = rand.Next(1, 100);

    }
    foreach (int value in nummers)
    {
        total += value;
        listBox1.Items.Add(value);
    }
    total/= 10;
    label3.Text = total.ToString("d");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:59:58+00:00Added an answer on June 15, 2026 at 9:59 pm

    You can use Linq to make your life easier:

    int minimum = numbers.Min();
    int maximum = numbers.Max();
    

    Old style:

    modify the foreach to be like this:

    int maximum = int.MinValue;
    int minimum = int.MaxValue;
    foreach (int value in nummers)
        {
            if (value < minimum) { minimum = value; }
            if (value > maximum) { maximum = value; }
    
            total += value;
            listBox1.Items.Add(value);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, just like the title says, I need to create an application that gets
Like the title says I need to write a function that will sort a
Like the title says, I need to load a video (.mp4) from the assets
Like the title says, I need to make a very customized view that behaves
Like the title says, I need a way to detect if the build is
Like the title says, we need to set up WCF services between a .NET
As the title says,i need to mass-assign products to a category and from the
Like the title says, I just need something to migrate a set of tables
The title pretty much says it all. I have a regex that I need
Like the title says, I need to use php (wordwrap or whatever works) to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.