public static void Main()
Console.WriteLine("Program to get the largest number in an array");
int[] arrays = {10, 2, 5, 10, 43, 10, 46, 23 };
int theSum = LargestArrayElement(arrays);
Console.WriteLine("The largest element is {0}", theSum);
private static int LargestArrayElement(int[] arr)
int largestEndingHere = 0;
for(int i = 0; i < arr.Length; i++)
largestEndingHere = arr[i];
if(largestEndingHere > largestSoFar)
largestSoFar = largestEndingHere;