public static void Main()
float[] ages = {16,16,16,14,14,14,15,17,18,15,14,14,17,14,15,16,14,16,16,16,16,14,15,16,36};
Console.WriteLine("The ages of the people in Ms. Durning’s 6th period class are:");
for (int i=0; i<ages.Length; i++)
{Console.Write(ages[i] + ",");}
Console.WriteLine("25 people in the class");
Console.WriteLine("The average of the ages in the class is " + ages.Average());
Console.WriteLine("The ages from least to greatest are: ");
for (int i=0; i<ages.Length; i++)
{Console.Write(ages[i] + ",");}
Console.WriteLine("The median of the ages are " + Median(ages));
static private float Median(float[] array)
float[] tempArray = array;
int count = tempArray.Length;
float middleElement1 = tempArray[(count / 2) - 1];
float middleElement2 = tempArray[(count / 2)];
medianValue = (middleElement1 + middleElement2) / 2;
medianValue = tempArray[(count / 2)];