Support our Blind Hand Charity by donating at 9818291723. Your contribution has the potential to bring about significant positive change for humanity.

Search This Blog

MY PROGRAMMES

Saturday, April 15, 2023

COMPLEX ROOTS OF QUADRATIC EQUATION

print("Enter the values in the form of ax^2+bx+c")
a=int(input("Enter the value of a = "))
b=int(input("Enter the value of b = "))
c=int(input("Enter the value of c = "))
d=(b**2)-(4*a*c)
if d<0:
    print("The zero =",(-b)/(2*a),"-i",int((d*-1)**0.5)/(2*a))
    print("The zero =",(-b)/(2*a),"+i",int((-1*d)**0.5)/(2*a))
elif d==0:
    x1=-b/2*a
    x2=-b/2*a
    print("The zeroes are =",x1,x2)
else:
    x1=(-b-(d)**0.5)/2*a
    x2=(-b+(d)**0.5)/2*a
    print("The zeroes are =",x1,x2)