Write a program to solve quadratic equation 2: ax2 + bx + c = 0 import math
"""
""" def giaPTBac2(a, b, c): # check the coefficients if (a == 0): if (b == 0): print("Equation has no solution!"); else: print("Equation has one solution: x = ", + (-c / b)); return;
# calculate delta
delta = b * b - 4 * a * c;
# calculation
if (delta > 0):
x1 = (float)((-b + math.sqrt(delta)) / (2 * a));
x2 = (float)((-b - math.sqrt(delta)) / (2 * a));
print ("Equation has 2 solutions: x1 = ", x1, " and x2 = ", x2));
elif (delta == 0):
x1 = (-b / (2 * a));
print("Equation with double solutions: x1 = x2 = ", x1);
else:
print("Equation has no solution!");
a = float(input("Enter the quadratic factor, a = ")); b = float(input("Enter the coefficient of order 1, b = ")); c = float(input("Enter a free constant, Python = "));
stagePTBac2(a, b, c)