Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This program calculates possible solutions for a quadratic equation#
- #####################################################################
- # Import math library
- import math
- # 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
- # Possible results
- x = (-b - (math.sqrt(d))) / (2 * a)
- y = (-b + (math.sqrt(d))) / (2 * a)
- result = (x, y)
- # Print the result
- print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement