İkinci Dereceden Denklem Çözümü
Gerekenler: 3 Metin Kutusu 1 Buton
Private Sub Komut6_Click()
Dim a, b, c, d, sx, sy, dk As Double
Metin0.SetFocus
a = Val(Metin0)
Metin2.SetFocus
b = Val(Metin2)
Metin4.SetFocus
c = Val(Metin4)
d = (b * b) - (4 * a * c)
If d < 0 Then
MsgBox ("Kök Yoktur.")
ElseIf d = 0 Then
sx = -b / 2 * a
sy = sx
MsgBox ("X1=X2" & Chr(13) & "X1=" & sx & Chr(13) & "X2=" & sy)
Else
sx = Round((-1 * b + Sqr(d)) / (2 * a), 1)
sy = Round((-1 * b - 1 * Sqr(d)) / (2 * a), 1)
MsgBox ("X1=" & sx & Chr(13) & "X2=" & sy)
End If
End Sub
Yorumlar
Yorum Gönder