'program mencari akar Option Explicit Sub UTS() Dim A As Double, B As Double, C As Double, d As Double Dim x1 As Double, X2 As Double

A = Sheets("sheet1").Range("c5").Value B = Sheets("sheet1").Range("c6").Value C = Sheets("sheet1").Range("c7").Value

x1 = 0: X2 = 0 If A = 0 Then If B <> 0 Then x1 = -C / B End If

If B = 0 Then MsgBox ("Tidak ada solusi") End If

Else d = B ^ 2 - (4 * A * C)

If d >= 0 Then x1 = (-B + (Sqr(d))) / (2 * A) X2 = (-B - (Sqr(d))) / (2 * A) Else x1 = -B / (2 * A) X2 = x1

Select ActiveCell.Select Range("b11").Offset(2.Value = x1 ActiveCell.Select End Sub .End If If d < 0 Then MsgBox ("Nilai dari X1 dan X2 bersifat Imajiner") End If End If 'display result Sheets("sheet1"). 0).Value = "selamat anda telah berhasil" ActiveCell.Select ActiveCell.Select ActiveCell.Offset(1.Offset(3. 0). 0).Value = X2 ActiveCell.

Sign up to vote on this title
UsefulNot useful