SHOW:
|
|
- or go back to the newest paste.
| 1 | a = float(input("Enter a: "))
| |
| 2 | b = float(input("Enter b: "))
| |
| 3 | c = float(input("Enter c: "))
| |
| 4 | ||
| 5 | if(math.pow(b,2) - (4*a*c) >= 0): | |
| 6 | x_1 = (-b + math.sqrt(math.pow(b,2) - (4*a*c)))/(2*a) | |
| 7 | x_2 = (-b - math.sqrt(math.pow(b,2) - (4*a*c)))/(2*a) | |
| 8 | print("x1 {} and x2 {}".format(x_1,x_2))
| |
| 9 | else: | |
| 10 | print("The root of the equation are imaginary numbers") |