Anda di halaman 1dari 1

Exercicio 8 - Triângulo

private void btnVerificar_Click(object sender, EventArgs e)


{
int a, b, c;
a = Convert.ToInt32(txtA.Text);
b = Convert.ToInt32(txtB.Text);
c = Convert.ToInt32(txtC.Text);

if ((a < b + c) && (b < a + c) && (c < a + b))


{
if ((a == b) && (a == c))
{
txtResp.Text = "É um triângulo Equilátero";
}

else if ((a != b) && (b != c) && (c != a))


{
txtResp.Text = "É um triângulo Escaleno";
}

else
txtResp.Text = "É um triângulo Isóceles";
}

else
{
txtResp.Text = "Não é um triângulo";
txtResp.BackColor = Color.Red;
txtResp.ForeColor = Color.White;
}
}

private void btnLimpar_Click_1(object sender, EventArgs e)


{
txtA.Clear();
txtB.Clear();
txtC.Clear();
txtResp.Clear();
txtResp.BackColor = Color.White;
txtA.Focus();
}

Anda mungkin juga menyukai