Program:


import math

print("Quadratic Equation: aX^2+bX+c\n")
print("Enter the Value of Coefficients a,b,c")
#Using Formula Method to Solve Quadratic Equation
a = int(input("a="))
b = int(input("b="))
c = int(input("c="))
d = (b**2) - (4*a*c)

root1 = (-b-math.sqrt(d))/(2*a)
root2 = (-b+math.sqrt(d))/(2*a)
print(f"\nSolutions:-  X1={root1}\tX2={root2}")

Expected O/P:


Quadratic Equation: aX^2+bX+c

Enter the Value of Coefficients a,b,c
a=1
b=5
c=6

Solutions:-  X1=-3.0 X2=-2.0