You are on page 1of 1

from math import sqrt

a = int(input())
b = int(input())
c = int(input())
delta = 0
def roots(a,b,c):
if a != 0:
delta = (b)**2 - (4*(a)*(c))
if delta > 0:
x1 = float((-b + sqrt(delta))/(2*a))
x2 = float((-b - sqrt(delta))/(2*a))
print(" There are 2 roots : {:.6f} and {:.6f}".format(x1,x2))
elif delta == 0:
x1 = x2 = -b/(2*a)
print(" There is one root : {}".format(x1))
else:
print(" No roots, discriminant < 0")
else:
print("There is not a quadratic equation")

roots(a,b,c)

You might also like