public static float average(int[] numbers) { int sum; foreach (int number in numbers) { sum += number; } return sum / numbers.Length; //note: their might be other simple ways }