# file: quadratic-equation.py def main(): print("This program solves a quadratic equation ax^2+bx+c=0 \ for the given coefficients a,b,c.") a = float(input("Enter coefficient a:")) b = float(input("Enter coefficient b:")) c = float(input("Enter coefficient c:")) import math D = b*b-4*a*c if D == 0: root = (-b + math.sqrt(D)) / (2*a) print("The solution of the quadratic equation ", a,"x^2 +",b,"x +",c,"= 0 is:") print(root) elif D > 0: root1=(-b+math.sqrt(D))/(2*a) root2=(-b-math.sqrt(D))/(2*a) print("The solutions of the quadratic equation ", a,"x^2 +",b,"x +",c,"= 0 are:") print(root1, ", ", root2) else: print("There are no real number solutions to the equation",a,"x^2 +",b,"x +",c,"= 0") main()