Standard deviation calculation code not working as intended

MMattK2/5/2023
Hello! I am currently trying to code a button that will calculate the mean and standard deviation from a set of 10 data values, however, my after coding my button calculates the mean properly but for whatever reason does not calculate the standard deviation and instead puts the value of the mean in its position instead.

I will leave a copy of the code below.
MMattK2/5/2023
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);
}
AAngius2/5/2023
lblStdDeviation.Text = y1.ToString();
AAngius2/5/2023
You set the text of both lblMeanText and lblStdDeviationText to y1 variable
AAngius2/5/2023
So of course they will be the same
MMattK2/5/2023
oh haha
MMattK2/5/2023
let me quickly fix that
AAngius2/5/2023
Also, $code
MMODiX2/5/2023
To post C# code type the following:
```cs
// code here
```

Get an example by typing $codegif in chat

If your code is too long, post it to: https://paste.mod.gg/
MMattK2/5/2023
oh I see thank you!
MMattK2/5/2023
I
MMattK2/5/2023
Does the calculation for the standard deviation look correct?
AAngius2/5/2023
Seems so
MMattK2/5/2023
it seems to be working now, I appreciate the assistance!
MMattK2/5/2023
I will close the post shortly