private void BtnCalcular_Click(object sender, EventArgs e) { if (TxtN1.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN1.Focus(); return; } if (TxtN2.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN2.Focus(); return; } if (TxtN3.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN3.Focus(); return; } double n1, n2, n3, rest; n1 = Convert.ToDouble(TxtN1.Text); n2 = Convert.ToDouble(TxtN2.Text); n3 = Convert.ToDouble(TxtN3.Text); rest = n1 + n2 + n3; TxtRest.Text = rest.ToString(); }
private void BtnCalcular_Click(object sender, EventArgs e) { if (TxtN1.Text.Trim().Length == 0) { MessageBox.Show("Ingres calificacion 1"); TxtN1.Focus(); return; } if (TxtN2.Text.Trim().Length == 0) { MessageBox.Show("Ingres calificacion 1"); TxtN2.Focus(); return; } double n1, n2; n1 = Convert.ToDouble(TxtN1.Text); n2 = Convert.ToDouble(TxtN2.Text); if (n1 < n2) { TxtRest.Text = TxtRest.Text + n1; } else { TxtRest.Text = TxtRest.Text + n2; } }
private void BtnCalcular_Click(object sender, EventArgs e) { if (TxtN1.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN1.Focus(); return; } if (TxtN2.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN2.Focus(); return; } if (TxtN3.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN3.Focus(); return; } if (TxtN4.Text.Trim().Length == 0) { MessageBox.Show("Ingrese un dato"); TxtN4.Focus(); return; } double n1, n2, n3, n4, prom; n1 = Convert.ToDouble(TxtN1.Text); n2 = Convert.ToDouble(TxtN2.Text); n3 = Convert.ToDouble(TxtN3.Text); n4 = Convert.ToDouble(TxtN4.Text); prom = (n1 + n2 + n3 + n4) / 4; TxtProm.Text = prom.ToString(); }