The document contains a Visual Basic code for calculating the roots of a quadratic equation based on user input values for coefficients a, b, and c. It handles different scenarios including indeterminate solutions and imaginary roots, providing appropriate messages to the user. Additionally, it includes functionality to reset the input fields and exit the application.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
2 views6 pages
Programa Ecuacion Cuadratica
The document contains a Visual Basic code for calculating the roots of a quadratic equation based on user input values for coefficients a, b, and c. It handles different scenarios including indeterminate solutions and imaginary roots, providing appropriate messages to the user. Additionally, it includes functionality to reset the input fields and exit the application.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6
CALCULO DE LA ECUACION CUADRATICA
CODIGO ECUACION CUADRATICA
Option Explicit Dim a As Double Dim b As Double Dim c As Double Dim d As Double Dim s1 As Double Dim s2 As Double
Private Sub CMDCALCULO_Click()
a=0 b=0 c=0 d=0 s1 = 0 s2 = 0 a = Val(TXTA.Text) b = Val(TXTB.Text) c = Val(TXTC.Text) d = (b ^ 2) - (4 * a * c) If 2 * a = 0 Then LBLMENSAJE1.Caption = "Solución indeterminada" Else If d >= 0 Then s1 = (-b + (d ^ 0.5)) / (2 * a) s2 = (-b - (d ^ 0.5)) / (2 * a) LBLSOLUCION1.Caption = " La solución 1 es " & s1 LBLSOLUCION2.Caption = " La solución 2 es " & s2 Else LBLMENSAJE2.Caption = "Solución imaginaria" End If End If End Sub
Aim - Write A Program in VB That Constructs A Scientific Calculator With Sine, Cosine, Tangent, Logarithm, 1 - X (Reciprocal), and SQR (Square Root) Functions