Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This program calculates possible solutions for a quadratic equation#
- #####################################################################
- # Coefficients of quadratic equation
- a = float(input("Enter quadratic coefficient: "))
- b = float(input("Enter linear coefficient: "))
- c = float(input("Enter constant coefficient: "))
- # Discriminant for calculating x
- D = b * b - 4 * a * c
- # Square root of discriminant
- d = D ** 0.5
- # Possible results
- x = (-b - d) / (2 * a)
- y = (-b + d) / (2 * a)
- result = (x, y)
- # Print the result
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement