April 1, 2015

How to get 2nd highest value from array in C# without using loop

static void Main(string[] args)
        {
           
int[] Arr = { 100, 500, 130, 145, 165};
           
Array.Sort(Arr);
           
Array.Reverse(Arr);
           
Console.Write(Arr[1].ToString());
           
Console.ReadLine();
        }

No comments:

Post a Comment