Hi,
I am trying to write the quadratic formula program:
Code:
# program to evaluate roots of quadratic eq using python
import math
a=1; b=1; c=100;
x1 = (-b + math.sqrt(b**2 - 4*a*c))/ (2 * a)
x2 = (-b - math.sqrt(b**2 - 4*a*c))/ (2 * a)
print (x1)
print (x2)
I am getting following errors:
Traceback (most recent call last):
File "quadraticeq.py", line 4, in <module>
x1 = (-b + math.sqrt(b**2 - 4*a*c))/ (2 * a)
ValueError: math domain error
Can somebody please guide me whats the error?
Zulfi.