Question: I got this homework assignment, cant figure it out.
I need to ask the user how many town names he wants to enter. For example 5.
Then, he enters the 5 town names.
Afterwards, we need to find the average length of the names and show him the names which have less letters than the average length. Thanks for your shared time :)
My code so far:

```
static void Main(string[] args)
{

    int n;
    Console.WriteLine("How many town names would you like to enter:");
    n = int.Parse(Console.ReadLine());
    string[] TownNames = new string[n];
    Console.Clear();
    Console.WriteLine("Enter {0} town names:", n);
    for (int i = 0; i < n; i++)
    {
        Console.Write("Enter number {0}: ", i + 1);
        TownNames[i] = Convert.ToString(Console.ReadLine());
    }

    Console.ReadKey(true);
}

static void Average(double[] TownNames, int n)
{

}

```

Answer: 
You replace the value each time in the loop, so the output is only the result of the last iteration: 4\*4.

Not exactly what calculation you want to do that will give you 24, but maybe you want to add the result to the previous value of y, or multiple it?
x = i+i will get executed for each of the values and the print the last one...

so will print 8 for the add and 16 for multiplication.