You are on page 1of 1

Private Sub Command1_Click()

Dim a As Integer, b As Integer, c As Integer, D As Single


Dim mensaje As String, x1 As Single, x2 As Single, ALFA As Single, BETA As
Single
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
If a = 0 Then
If b = 0 Then
mensaje = "NO HAY ECUACION"
Else
x1 = -c / b
Text5.Text = x1
End If
Else
D=b^2-4*a*c
mensaje = "SI HAY RAICES"
If D < 0 Then
ALFA = -b / (2 * a)
BETA = ((-D) ^ (1 / 2)) / (2 * a)
Text5.Text = ALFA & " + " & BETA & "*i"
Text6.Text = ALFA & " - " & BETA & "*i"
mensaje = "hay raices imaginarias"
Else
Text5.Text = (-b + D ^ (1 / 2)) / (2 * a)
Text6.Text = (-b - D ^ (1 / 2)) / (2 * a)
End If
End If
Text4.Text = mensaje
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text1.SetFocus
End Sub

You might also like