这是我的公式
Else : cmb1.Text = "Rata - Rata"
' hitung rata-rata
rerata = jumlah / lstData.Items.Count
' menampilkan hasil rerata ke text box
txtRerata.Text = rerata.ToString
cmb1.Text = "Variansi" Then
'inisialisasi variabel variansi
Xi = lstData.Items.Item(index:=counter)
' hitung variansi
For counter = 0 To lstData.Items.Count - 1
variansi = (Xi - rerata) * (Xi - rerata)
Next
'menampilkan hasil variansi ke text box
txtVariansi.Text = variansi.ToString
End If
这有什么问题?我无法得到结果。谢谢
如果是这样呢?
ElseIf cmb1.Text = "Variansi" Then 'inisialisasi variabel variansi Xi = 0
' iterasi sejumlah item dari listbox
For counter = 0 To lstData.Items.Count - 1
Xi = Xi + ((lstData.Items.Item(counter) - rerata) ^ 2)
Next
'kalkulasi variansi dan simpangan baku
variansi = Xi / (txtN.Text - 1)
SD = Math.Sqrt(variansi)
txtSD.Text = SD.ToString
'menampilkan hasil variansi ke text box
txtVariansi.Text = variansi.ToString
你能帮助我吗 ?