int[] myArray = new int[] { 0, 1, 2, 3, 13, 8, 5 };
int largest = int.MinValue;
int second = int.MinValue;
foreach (int i in myArray)
{
if (i > largest)
{
second = largest;
largest = i;
}
else if (i > second)
second = i;
}
System.Console.WriteLine(second);
int[] array = { 2, 11, 15, 1, 7, 99, 6, 85, 4 };
ReplyDeleteArray.Sort(array); //sorting array
Array.Reverse(array); // Reverse Sorting array value
Console.WriteLine("Second Highest Value In Array " + array[1]);
foreach (var result in array)
{
Console.Write(result + " "); // Array values
}