Public Class Form1
Dim a, b, c, d, r1, r2, temp As Single
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCLICK.Click
a = TXTxsq.Text
b = TXTx.Text
c = TXTCON.Text
d = b ^ 2 - 4 * a * c
TXTd.Text = d
temp = d ^ (1 / 2)
If (d > 0) Then
lblchar.Text = "Roots are Real and Unequal"
r1 = ((-b) + temp) / (2 * a)
r2 = ((-b) - temp) / (2 * a)
TXTr1.Text = r1
TXTr2.Text = r2
ElseIf (d = 0) Then
lblchar.Text = "Roots are Real and equal"
r1 = (-b) / (2 * a)
r2 = (-b) / (2 * a)
TXTr1.Text = r1
TXTr2.Text = r2
Else
lblchar.Text = "Roots are imaginary"
TXTr1.Text = ""
TXTr2.Text = ""
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
No comments:
Post a Comment
Note: only a member of this blog may post a comment.