How to calculate the highest/average number in console?

csharp programming , visual studio , console application Vancouver, Canada
  • 12 years ago
    const int ARRAY_LENGTH = 5; double[] commission = new double[ARRAY_LENGTH]; int countAll = 150; Console.Out.WriteLine("Please enter commission amounts for 5 months: "); for (int index = 0; index < ARRAY_LENGTH; index++) commission[index] = double.Parse(Console.In.ReadLine()); Console.Out.WriteLine("\nThe commission amounts entered are: "); for (int index = 0; index < ARRAY_LENGTH; index++) Console.Out.Write(commission[index].ToString() + " "); for (int index = 1; index < 5; index++) { double sales = double.Parse(ARRAY_LENGTH[index](Console.In.ReadLine()); if (ARRAY_L > highest) highest = sales; } txtHighest.Text = highest.ToString("C"); Console.In.ReadLine(); //wait for enter key I can't figure out how to get the highest. The highest numbers have to be over 150. The average is just a blur to me.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Anyone who considers arithmetic methods of producing random digits is, of course, in a state of sin.” - John von Neumann