I'm working on a program to convert a set of values to an average and I keep getting an exception error. Seems to be an easy fix but I can't put my finger on it. Any suggestions?
private void button1_Click(object sender, EventArgs e)
{
int sum = 0;
int ave = 0;
int[] temp = new int[10];
sum = int.Parse(txtData.Text);
for (int i = 0; i < 10; i++)
{
sum = sum + temp[i];
}
ave = sum / 10;
txtAve.Text = ave.ToString();
}
}