Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Written by: ETechSavvies [https://t.me/ETechSavvies] Apr 27,2021
- Description: Quadratic equation solver
- Copyright 2021 @ETechSavvies
- """
- #import complex math module
- import cmath
- a = float(input("Enter the value of a= "))
- b = float(input("Enter the value of b= "))
- c = float(input("Enter the value of c= "))
- # calculate the discriminant
- d = (b**2) - (4*a*c)
- # Calculating the first solution
- sol1 = (-b-cmath.sqrt(d))/(2*a)
- # Calculating the second solution
- sol2 = (-b+cmath.sqrt(d))/(2*a)
- print('The solution of your quadratic equation are {0} and {1}'.format(sol1,sol2))
Advertisement
Add Comment
Please, Sign In to add comment