Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub CommandButton1_Click()
- Dim a, b, c, d As Integer
- Dim x1, x2 As Double
- a = val(InputBox1("Введите параметр a"))
- b = val(InputBox2("Введите параметр b"))
- c = val(InputBox3("Введите параметр c"))
- d = (b ^ 2) - (4 * a * c)
- MsgBox("d=" & d)
- Select Case d
- Case Is < 0
- MsgBox("НЕТ РЕШЕНИЯ")
- Case 0
- x1 = (-b) / (2 * a)
- x2 = (-b) / (2 * a)
- TextBox5 = "x1=" & x1 & "x2=" & x2
- Case Is > 0
- x1 = (-b + Sqr(d)) / (2 * a)
- x2 = (-b - Sqr(d)) / (2 * a)
- MsgBox("x1=" & x1 & "x2=" & x2)
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement