MattK
Standard deviation calculation code not working as intended
private void button1_Click(object sender, EventArgs e)
{
int y1;
y1 = (x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) / 10;
lblMeanText.Text = y1.ToString();
double sumsquared = Math.Pow(x1 - y1, 2) + Math.Pow(x2 - y1, 2) + Math.Pow(x3 - y1, 2) + Math.Pow(x4 - y1, 2) + Math.Pow(x5 - y1, 2) + Math.Pow(x6 - y1, 2) + Math.Pow(x7 - y1, 2) + Math.Pow(x8 - y1, 2) + Math.Pow(x9 - y1, 2) + Math.Pow(x10 - y1, 2);
lblStdDeviation.Text = y1.ToString();
double standarddeviation = Math.Sqrt(sumsquared / 10);
}
15 replies