VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Finding real roots of quadratic equation.

by P N Bendigeri (2 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Sun 2nd January 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Finding real roots of quadratic equation.

Rate Finding real roots of quadratic equation.




Private Type QuaEqu
    x1 As Double
    x2 As Double
End Type

Dim d As Double

Private Function RootsOfQuaEqu(ByVal a As Single, ByVal b As Single, ByVal c As Single) As QuaEqu
    d = (b * b - 4 * a * c)
    If d < 0 Then
        MsgBox "Roots are Imaginary"
        Exit Function
    End If
    RootsOfQuaEqu.x1 = (-b + Sqr(d)) / (2 * a)
    RootsOfQuaEqu.x2 = (-b - Sqr(d)) / (2 * a)
End Function

Download this snippet    Add to My Saved Code

Finding real roots of quadratic equation. Comments

No comments have been posted about Finding real roots of quadratic equation.. Why not be the first to post a comment about Finding real roots of quadratic equation..

Post your comment

Subject:
Message:
0/1000 characters