➽ Program:-

import cmath

a = float(input("Enter First Coefficient: "))

b = float(input("Enter Second Coefficient: "))

c = float(input("Enter Third Coefficient: "))

 

# calculate discriminant

d = (b**2)-(4*a*c)

 

# calculate Roots

Root1 = (-b-cmath.sqrt(d))/(2*a)

Root2 = (-b+cmath.sqrt(d))/(2*a)

 

print("Root1 = {:.2f}".format(Root1))

print("Root2 = {:.2f}".format(Root2))

➽ Output:-

Enter First Coefficient: 7
Enter Second Coefficient: 8.1
Enter Third Coefficient: 10.2

Root1 = -0.58-1.06j
Root2 = -0.58+1.06j