check the minimum value (Doube Data Type)

Oct 15 2018 2:28 AM
how can i check minimun value from 3 variable like this : MK_1 = 60, MK_2 = 50, MK_3 = 55
 
private void HitungNilaiKompre()
{
if (txtPenguji1_Nilai.Text.Trim().Length == 0) txtPenguji1_Nilai.Text = "0";
if (txtPenguji2_Nilai.Text.Trim().Length == 0) txtPenguji2_Nilai.Text = "0";
if (txtPenguji3_Nilai.Text.Trim().Length == 0) txtPenguji3_Nilai.Text = "0";
double NILAI_MK_1 = Convert.ToDouble(txtPenguji1_Nilai.Text);
double NILAI_MK_2 = Convert.ToDouble(txtPenguji2_Nilai.Text);
double NILAI_MK_3 = Convert.ToDouble(txtPenguji3_Nilai.Text);
double TOTAL = (NILAI_MK_1 + NILAI_MK_2 + NILAI_MK_3);
double RATA = ((NILAI_MK_1 + NILAI_MK_2 + NILAI_MK_3) / 3);
string MK_BERSYARAT = "";
string PENGUJI_BERSYARAT = "";
string hasil_akhir = "";
if (TOTAL >= 180)
{
hasil_akhir = "Lulus";
}
else if (TOTAL >= 162 && TOTAL < 180)
{
hasil_akhir = "Bersyarat";
if (NILAI_MK_1 < 60)
{
MK_BERSYARAT = tbMK_1.Text;
PENGUJI_BERSYARAT = cbPenguji_1.Text;
}
if (NILAI_MK_2 < 60)
{
MK_BERSYARAT = tbMK_2.Text;
PENGUJI_BERSYARAT = cbPenguji_2.Text;
}
if (NILAI_MK_3 < 60)
{
MK_BERSYARAT = tbMK_3.Text;
PENGUJI_BERSYARAT = cbPenguji_3.Text;
}
}
else if (TOTAL > 0 && TOTAL < 162)
{
hasil_akhir = "Tidak Lulus";
}
else
{
hasil_akhir = "Tidak Hadir";
}
txtRata.Text = RATA.ToString("N2");
txtHasil.Text = hasil_akhir;
txtMK_Bersyarat.Text = MK_BERSYARAT;
txtPenguji_Bersyarat.Text = PENGUJI_BERSYARAT;
}
 
the problem in 'bersyarat' if i insert : MK_1 = 60, MK_2 = 50, MK_3 = 55
why the minimum value is 55, i know the problem in here
 
else if (TOTAL >= 162 && TOTAL < 180)
{
hasil_akhir = "Bersyarat";
if (NILAI_MK_1 < 60)
{
MK_BERSYARAT = tbMK_1.Text;
PENGUJI_BERSYARAT = cbPenguji_1.Text;
}
if (NILAI_MK_2 < 60)
{
MK_BERSYARAT = tbMK_2.Text;
PENGUJI_BERSYARAT = cbPenguji_2.Text;
}
if (NILAI_MK_3 < 60)
{
MK_BERSYARAT = tbMK_3.Text;
PENGUJI_BERSYARAT = cbPenguji_3.Text;
}
}
 
 how can i check minimum data in double data type? help... thanks before

Answers (1)