
Public Class Form1
    Dim a, b, c, x1, x2, delta, kq As Double
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        a = CDbl(TextBox1.Text)
        b = CDbl(TextBox2.Text)
        c = CDbl(TextBox3.Text)
        delta = (b * b) - (4 * a * c)
        If a <> 0 Then
            If delta > 0 Then
                x1 = (-b + ((delta) ^ 0.5)) / (2 * a)
                x2 = (-b - ((delta) ^ 0.5)) / (2 * a)
                TextBox4.Text = "x1 = " & CStr(x1) & ",  x2 = " & CStr(x2)
            ElseIf delta = 0 Then
                kq = (-b) / (2 * a)
                TextBox4.Text = "x1 = x2 =  " & CStr(kq)
            Else
                TextBox4.Text = CStr("vô nghiệm")
            End If
        Else
            TextBox4.Text = CStr("đây không phải pt bậc 2")
        End If
    End Sub
End Class

