Posted by : Unknown
Rabu, 27 November 2013
nich....scripnya....
import math
a = input("masukkan a: ")
b = input("masukkan b: ")
c = input("masukkan c: ")
dua_a = 2.0 * a
disk = b*b - 4*a*c
if disk > 0:
print"Akar Imaginer"
akardisk = math.sqrt(disk)
akar1 = (-b + akardisk)/dua_a
akar2 = (-b - akardisk)/dua_a
elif disk == 0:
print"Akar kembar="
akar1 = -b/dua_a
akar2 = akar1
else:
akar1 = -b/dua_a
akar11 = math.sqrt(abs(disk))/dua_a
akar2 = akar1
akar12 = -akar11
print "x1:", akar1
print "x2:", akar2
import math
a = input("masukkan a: ")
b = input("masukkan b: ")
c = input("masukkan c: ")
dua_a = 2.0 * a
disk = b*b - 4*a*c
if disk > 0:
print"Akar Imaginer"
akardisk = math.sqrt(disk)
akar1 = (-b + akardisk)/dua_a
akar2 = (-b - akardisk)/dua_a
elif disk == 0:
print"Akar kembar="
akar1 = -b/dua_a
akar2 = akar1
else:
akar1 = -b/dua_a
akar11 = math.sqrt(abs(disk))/dua_a
akar2 = akar1
akar12 = -akar11
print "x1:", akar1
print "x2:", akar2