15. Write a VB program to find the roots of quadratic equation.


Private Sub cmdClear_Click()
Text1.Text = “”
Text2.Text = “”
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdFind_Click()
Dim a, b, c As Integer
Dim s, r1, r2 As Double
b = Val(InputBox(“enter value for b”))
a = Val(InputBox(“enter value for a”))
c = Val(InputBox(“enter value for c”))
s = Sqr(b * b – (4 * a * c))
r1 = (b + s) / (2 * a)
r2 = (-b + s) / (2 * a)
Text1.Text = r1
Text2.Text = r2
End Sub

2 thoughts on “15. Write a VB program to find the roots of quadratic equation.

  1. jude says:

    Itz showing me run time error 5

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s