- Home
·
- Math/Dates
·
- Solves quadratic equations... Guranteed success...
Solves quadratic equations... Guranteed success...
Solves quadratic equations... Guranteed success...
Rate Solves quadratic equations... Guranteed success...
(1(1 Vote))
Dim discrim, a, b, c, x1, x2 As Double
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
d = b ^ 2 - 4 * a * c
If d < 0 Then
Label4.Caption = "x1 = No Real Roots..."
Label5.Caption = "x2 = No Real Roots..."
ElseIf a = 0 And Not b = 0 Then
x2 = -c / b
Label4.Caption = "x1 = No Answer Available..."
Label5.Caption = "x2 = " + Str(x2)
ElseIf a = 0 And b = 0 Then
Label4.Caption = "x1 = No Answer Available..."
Label5.Caption = "x2 = No Answer Available..."
Else
x1 = (-b + Math.Sqr(d)) / (2 * a)
x2 = (-b - Math.Sqr(d)) / (2 * a)
Label4.Caption = "x1 = " + Str(x1)
Label5.Caption = "x2 = " + Str(x2)
End If
End Sub
Solves quadratic equations... Guranteed success... Comments
No comments yet — be the first to post one!
Post a Comment