Method 1
Method 2
Method 1
# Use to import complex math module
import cmath
a = 1
b = 6
c = 5
d = (b**2) - (4*a*c)
s1 = (-b-cmath.sqrt(d))/(2*a)
s2 = (-b+cmath.sqrt(d))/(2*a)
print("The first roots is:",s1)
print("The first roots is:",s2)
Method 2
# Use to user input also use import complex math module
import cmath
print("Enter the a value")
a=int(input())
print("Enter the b value")
b=int(input())
print("Enter the c value")
c=int(input())
d = (b**2) - (4*a*c)
s1 = (-b-cmath.sqrt(d))/(2*a)
s2 = (-b+cmath.sqrt(d))/(2*a)
print("The first roots is:",s1)
print("The first roots is:",s2)