static private int Median(int[] array)
int count = tempArray.Length;
int middleElement1 = tempArray[(count / 2) - 1];
int middleElement2 = tempArray[(count / 2)];
medianValue = (middleElement1 + middleElement2) / 2;
medianValue = tempArray[(count / 2)];
public static void Main()
int[] list = new int[10];
for (int i = 0; i < 10; i++)
list [i] = r.Next(1, 101);
Console.Write(list[i] + " ");
Console.Write("\n Your numbers in order from least to greatest are: ");
foreach(int number in list)
Console.Write(number + " ");
Console.WriteLine("\n The average of your list of numbers is: " + list.Average());
Console.WriteLine("The median of your list of numbers is: " + Median(list));
Console.WriteLine("Would you like to restart the program? y/n");
string choice = Console.ReadLine();
if(choice == "y" || choice == "Y")