Following is program to find out the roots of a quadratic equation :
Note : Conside the case of both real and imaginary roots.
a=int(input("enter coefficient of x^2\n"))
b=int(input("enter the coefficient of x\n"))
c=int(input("enter the coefficient of x^0\n"))
d =(b**2 - 4*a*c)
if(d<0):
e =((-d)**0.5)/2*a
f =-b/2*a
print(f"Imaginary roots of {a}x^2+{b}x+{c}=0 are {f}+i{e} and {f}-i{e}.")
else:
x1=( -b + (d)**0.5 )/2*a
x2=( -b - (d)**0.5 )/2*a
print(f"the roots of {a}x^2+{b}x+{c}=0 are {x1} and {x2}.")x1 and x2 are the roots of the quadratic equation
d – discriminant of the quadratic equation



