keeps gettings errors in this program

Can someone please help with this. I keep getting errors.


using System;

public class AverageNumbers

{

public static void Main()

{

const int QUIT = 999;

int numbers = new int[20];

int num;

string inString;





// Ask user to enter a number or QUIT to exit

Console.Write("Please enter a number or " + QUIT + " to quit...");

inString = Console.ReadLine();

num = Convert.ToInt32(intString);



int x;

double total;



x = 0;

double total;

while((x < numbers.Length))

{

numbers[x] = num;

++x;

total += numbers[x];

Console.Write("Please enter a number or " + QUIT + " to quit...");

inString = Console.ReadLine();

numbers = Convert.ToInt32(inString);

}

Console.WriteLine("The numbers are:");

for(int y = 0; y < x; ++y)

Console.Write("{0,6}", numbers[y]);



double average;

average = total / numbers.Length;

Console.WriteLine();

Console.WriteLine("The average is {0}", average);

Console.Read();

}

}



What the...
This is C#!
Topic archived. No new replies allowed.