VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Solve Equations

by Saeed J.Ghanim (5 Submissions)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 23rd January 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Solve Equations

API Declarations


Dim x2 As Double


Rate Solve Equations



Private Sub form_load()
Dim x1 As Double
Dim x2 As Double
 a = InputBox(" Enter the coefficient of x^2:a")
 b = InputBox("Enter the coefficient of x:b")
 c = InputBox("Enter the contant of the equation:c")
 d = ((b * b) - (4 * a * c))
 e = 2 * a
 If Val(d) < 0 Then
 MsgBox "the equation has no real or equal roots"
 End If
 If Val(d) >= 0 Then
  f = Val(d ^ 0.5)
  x1 = (-b + f) / e
  x2 = (-b - f) / e
  MsgBox " the roots of the equation are:" & Str(x1) & "," & Str(x2)
  End If
End Sub

Download this snippet    Add to My Saved Code

Solve Equations Comments

No comments have been posted about Solve Equations. Why not be the first to post a comment about Solve Equations.

Post your comment

Subject:
Message:
0/1000 characters