Finding the max value in an array

using System;

System;

namespace FindMaxValue

{

class Program

FindMaxValue

{

class Program

class Program

{

static void Main(string[] args)

{

int[] myArray = new int[] {22,10,4,6,33,7,8,9,11};

Console.Write(MaxValue.FindMax(myArray));

Console.ReadLine();

}

}

class MaxValue

static void Main(string[] args)

{

int[] myArray = new int[] {22,10,4,6,33,7,8,9,11};

Console.Write(MaxValue.FindMax(myArray));

Console.ReadLine();

}

}

class MaxValue

int[] myArray = new int[] {22,10,4,6,33,7,8,9,11};

Console.Write(MaxValue.FindMax(myArray));

Console.ReadLine();

}

}

class MaxValue

Console.Write(MaxValue.FindMax(myArray));

Console.ReadLine();

}

}

class MaxValue

Console.ReadLine();

}

}

class MaxValue

class MaxValue

{

public static int FindMax(int[] array)

{

int maxValue = array[0];

for(int i=1; i<array.Length; i++)

{

if (array[i] > maxValue)

maxValue = array[i];

}

return maxValue;

}

}

}

public static int FindMax(int[] array)

{

int maxValue = array[0];

for(int i=1; i<array.Length; i++)

{

if (array[i] > maxValue)

maxValue = array[i];

}

return maxValue;

}

}

}

int maxValue = array[0];

for(int i=1; i<array.Length; i++)

{

if (array[i] > maxValue)

maxValue = array[i];

}

return maxValue;

}

}

}

for(int i=1; i<array.Length; i++)

{

if (array[i] > maxValue)

maxValue = array[i];

}

return maxValue;

}

}

}

if (array[i] > maxValue)

maxValue = array[i];

}

return maxValue;

}

}

}

return maxValue;

}

}

}

Published Friday, September 22, 2006 9:43 PM by sanjeebsarangi
Filed under:

Comments

Friday, November 09, 2007 4:57 PM by Socheat Yi

# re: Finding the max value in an array

Using N/2:

       public static int FindLargestItem(int[] arr)

       {

           int length = arr.Length;

           int last = length - 1;

           int largest =arr[0];

           for (int i = 1; i <= length / 2; i++)

           {

               if (arr[i] > arr[last] && arr[i]>largest) largest = arr[i];

               else if(arr[last]>largest) largest = arr[last];

               last--;

           }

           return largest;

       }

Sunday, November 04, 2012 4:21 AM by icons archive

# re: Finding the max value in an array

[url=turbodacha.fatal.ru/.../index.php] I am am excited too with this question. You will not prompt to me, where I can read about it?[/url]

Wednesday, November 21, 2012 7:46 PM by Burberry Outlet

# re: Finding the max value in an array

If your ears glow, someone is talking of you.

Monday, December 10, 2012 11:22 PM by icondesignipving.se

# re: Finding the max value in an array

By WebOsPublisher

Account icon images. Download links for Account icon from icon archive

Account Icon Images

Icon Editor

Icon Converter

Icon Extractor

Icon Creator

Medical Icons

Search Icons

Icon Sets

Smile Icons

Icon Archive

Account Icon Images

You can purchase these icons for your projects. Click on icons to purchase them.

Account    Perfect CMS Icons

Account    Perfect User Icons

Account    Perfect Web Icons

Account    Perfect Internet Icons

Account    Perfect Office Icons

Account    Professional Toolbar Icons

Account    Glossy Data Icons

Account    Glossy Business Icons

Account    Medical Toolbar Icons

Account      Standard Geo Icons

Account      Standard Admin Icons

Account      Standard Dating Icons

Account      Standard Toolbar Icons

Account      Large User Icons

Account    Dating Web Icons

Accounts    Perfect Logistic Icons

Accounts    Perfect Business Icons

Accounts    Perfect Bank Icons

Accounts    Ribbon Bar Icons

Accounts    Professional Toolbar Icons

Accounts    Glossy Business Icons

Accounts    Glossy Toolbar Icons

Accounts    Medical Toolbar Icons

Accounts      Standard Geo Icons

Accounts      Standard Dating Icons

Accounts      Large Button Icons

Accounts      Large User Icons

Accounts    Small Windows Icons

Accounts    Dating Web Icons

User account    Perfect Automation Icons

User account    Perfect CMS Icons

FTP account    Perfect CMS Icons

Account cards    Perfect Toolbar Icons

Account card    Perfect Toolbar Icons

Bank account    Perfect Toolbar Icons

Account cards    Perfect Database Icons

Account card    Perfect Database Icons

Account ID    Perfect Bank Icons

Account cards    Perfect Bank Icons

Account card    Perfect Bank Icons

Bank account    Light Blue iPhone Toolbar Icons

Account cards    Light Blue iPhone Toolbar Icons

Account card    Light Blue iPhone Toolbar Icons

Bank account    Orange Toolbar Icons

Account cards    Orange Toolbar Icons

Account card    Orange Toolbar Icons

Bank account    Green Toolbar Icons

Account cards    Green Toolbar Icons

Account card    Green Toolbar Icons

Bank account    Red Toolbar Icons

Account cards    Red Toolbar Icons

Account card    Red Toolbar Icons

Bank account    Blue Toolbar Icons

Account cards    Blue Toolbar Icons

Account card    Blue Toolbar Icons

Bank account    Black Toolbar Icons

Account cards    Black Toolbar Icons

Account card    Black Toolbar Icons

View account    Ribbon Bar Icons

Problem account    Professional Toolbar Icons

Account card    Professional Toolbar Icons

Account card    Glossy Data Icons

Account cards    Glossy Toolbar Icons

Account card    Glossy Toolbar Icons

Bank account    Glossy Toolbar Icons

View account    Phone Toolbar Icons

Account cards    Accounting Toolbar Icons

Account card    Accounting Toolbar Icons

User account    Security Toolbar Icons

Account cards      Standard Geo Icons

Account card      Standard Geo Icons

View account      Standard Telephone Icons

Remove account      Standard Admin Icons

Edit account      Standard Admin Icons

Add account      Standard Admin Icons

FTP account      Standard Admin Icons

Account card      Large User Icons

Account books      Large Money Icons

View account    Small Person Icons

Account cards    Small Menu Icons

Account card    Small Menu Icons

Bank account    Small Menu Icons

Account cards    Small Glossy Icons

Account card    Small Glossy Icons

Account ID    Small PNG Icons

User account    Security Software Icons

Account cards    Accounting Development Icons

Account card    Accounting Development Icons

Icon Creator  |  Icon Software  |  Download Icons  |  Buy Icons  |  Icon Sets  |  Support

Copyright &copy; 2005-2012 SibCode. All rights reserved.

Stock Icon Libraries

Database Toolbar Icons

People Icons for Vista

Business Toolbar Icons

Perfect Toolbar Icons

Multimedia Icons for Vista

Leave a Comment

(required) 
(required) 
(optional)
(required)