Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import cmath
- # Resolução equação segundo grau
- def solvequadeq(a, b, c): # funcao equacao 2* grau
- D = b**2 - 4 * a * c
- x1 = (-b - cmath.sqrt(D)) / (2 * a)
- x2 = (-b + cmath.sqrt(D)) / (2 * a)
- return x1, x2
- #a*x**2 + b*x + c
- a = int(input('A = a.x^2'))
- b = int(input('B = b.X'))
- c = int(input('C = c'))
- print('Equacão: {}*x**2 + {}*x + {} = 0'.format(a, b, c))
- solutions = solvequadeq(a, b, c)
- print('Respostas :')
- print('x1 = %s' % solutions[0])
- print('x2 = %s' % solutions[1])
Advertisement
Add Comment
Please, Sign In to add comment