How to Find the Roots of Quadratic Equation in VB.Net
Submitted by janobe on Monday, October 29, 2018 - 19:41.
If you are trying to write code on how to solve quadratic equations, hopefully this tutorial will help you a lot. In this simple program, it will determine the number of roots the equation has and as well as compute the roots. Just follow the steps below to find it out.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
Or feel free to comment below.
Creating Application
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application.
Step 2
Do the form just like this.
Step 3
Double click the button to fire theclick event handler
of it and create a method for finding the roots of q quadratic equation.
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- Dim a, b, c As Integer
- Dim sqrt, result1, result2 As Double
- b = Val(InputBox(“enter value for b”))
- a = Val(InputBox(“enter value for a”))
- c = Val(InputBox(“enter value for c”))
- sqrt = Math.Sqrt(b * b - (4 * a * c))
- result1 = (b + s) / (2 * a)
- result2 = (-b + s) / (2 * a)
- TextBox1.Text = result1
- TextBox2.Text = result2
- End Sub
Add new comment
- 3797 views