Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- a = input("коэффицент a:")
- a = int(a)
- b = input("коэффицент b:")
- b = int(b)
- c = input("коэффицент c:")
- c = int(c)
- f = input("введите первую точку:")
- f = int(f)
- s = input("введите вторую точку:")
- s = int(s)
- D = (b**2-4*a*c)
- if D < 0:
- print("нет корней")
- else:
- x1 = ((-b+math.sqrt(D))/(2*a))
- x2 = ((-b - math.sqrt(D))/(2*a))
- if x1 >= f and x1 <=s and x2 >= f and x2 <= s:
- print("два решения")
- elif x1 >= f and x1 <=s or x2 >= f and x2 <= s:
- print("одно решение")
- elif not x1 >= f and not x1 <=s and not x2 >= f and not x2 <= s:
- print("нет решений")
- elif D == 0 and x1 >= f and x1 <=s:
- print("одно решение")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement