Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. import math
  2. a = input("коэффицент a:")
  3. a = int(a)
  4.  
  5. b = input("коэффицент b:")
  6. b = int(b)
  7.  
  8. c = input("коэффицент c:")
  9. c = int(c)
  10.  
  11. f = input("введите первую точку:")
  12. f = int(f)
  13.  
  14. s = input("введите вторую точку:")
  15. s = int(s)
  16.  
  17. D = (b**2-4*a*c)
  18.  
  19. if D < 0:
  20.     print("нет корней")
  21. else:
  22.     x1 = ((-b+math.sqrt(D))/(2*a))
  23.     x2 = ((-b - math.sqrt(D))/(2*a))
  24.  
  25. if x1 >= f and x1 <=s and x2 >= f and x2 <= s:
  26.     print("два решения")
  27.  
  28. elif x1 >= f and x1 <=s or x2 >= f and x2 <= s:
  29.     print("одно решение")
  30.  
  31. elif not x1 >= f and not x1 <=s and not x2 >= f and not x2 <= s:
  32.     print("нет решений")
  33.  
  34. elif D == 0 and x1 >= f and x1 <=s:
  35.     print("одно решение")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement