equazione secondo grado

soluzione equazione 2°
vedi
matema11.xls

Private Sub CommandButton1_Click()
Rem matema11
'
soluzione equazione secondo grado

Dim a As Double
Dim b As Double
Dim c As Double
Dim delta As Double

a = Cells(4, 4)
b = Cells(5, 4)
c = Cells(6, 4)
delta = b ^ 2 - 4 * a * c
Cells(9, 4) = delta
If delta >= 0 Then
Cells(10, 4) = (-b + Sqr(delta)) / 2 * a
Cells(11, 4) = (-b - Sqr(delta)) / 2 * a
Else
Cells(10, 4) = "non radici reali"
Cells(11, 4) = "non radici reali"
End If
End Sub


Private Sub CommandButton2_Click()
Rem cancellare
For k = 4 To 12
Cells(k, 4) = ""
Next k
End Sub