VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Solves quadratic equations... Guranteed success...

by Barryblitz (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 12th January 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Solves quadratic equations... Guranteed success...

Rate Solves quadratic equations... Guranteed success...




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


Download this snippet    Add to My Saved Code

Solves quadratic equations... Guranteed success... Comments

No comments have been posted about Solves quadratic equations... Guranteed success.... Why not be the first to post a comment about Solves quadratic equations... Guranteed success....

Post your comment

Subject:
Message:
0/1000 characters