//Problem 3
using System;
public class Program
{
static int SecondMax(int[] x) {
int temp = 0;
for (int write = 0; write < x.Length; write++)
for (int sort = 0; sort < x.Length - 1; sort++)
if (x[sort] > x[sort + 1])
temp = x[sort + 1];
x[sort + 1] = x[sort];
x[sort] = temp;
}
return x[x.Length - 2];
public static void Main()
int[] a={4,5,9,7,124315};
Console.WriteLine(SecondMax(a));
// please implement this program