Solve Equations
Solve Equations
API Declarations
Dim x2 As Double
Rate Solve Equations
(1(1 Vote))
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
Solve Equations Comments
No comments yet — be the first to post one!
Post a Comment