Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- from math import sqrt
- a, b, c = input("enter a, b, c: ").split()
- if a == 0: a = 1
- else: a = int(a)
- if b == 0: b = 1
- else: b = int(b)
- if c == 0: c = 1
- else: c = int(c)
- D = (b**2 - 4 * a * c)
- print("D:", D)
- if D > 0:
- D = sqrt(D)
- if not D.is_integer():
- D = D
- else:
- print("корней нет!")
- exit(0)
- print("sqrt(D):", D)
- x1 = (-b - D) / (2 * a)
- x2 = (-b + D) / (2 * a)
- print("x1 = " + str(x1))
- print("x2 = " + str(x2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement