Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = float(input())
- b = float(input())
- c = float(input())
- d = b ** 2 - 4 * a * c
- if a == 0:
- if b == 0:
- if c == 0:
- print('Any number')
- else:
- print('No solution')
- else:
- print('x =', -c / b) # Solve linear equation bx + c = 0
- elif d > 0:
- x1 = (-b + d ** 0.5) / (2 * a)
- x2 = (-b - d ** 0.5) / (2 * a)
- print('x1 =', x1, 'x2=', x2)
- elif d == 0:
- print('x =', -b / (2 * a))
- else:
- print('No solution')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement