Advertisement
dmemsm

Вопрос 2

Jan 24th, 2024
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. import math
  2.  
  3. a, b, c = map(int, input().split())
  4. #ax**2+bx+c-16=0
  5. c -= 16
  6. D = b**2-4*a*c
  7. if D < 0:
  8.     print("Нет корней")
  9. elif D == 0:
  10.     x = -1*b/(2*a)
  11.     print("Один корень: " + x)
  12. else:
  13.     sqrtd = math.sqrt(D)
  14.     x1 = (-1*b-sqrtd)/(2*a)
  15.     x2 = (-1*b+sqrtd)/(2*a)
  16.     print(f"Два корня: {x1} и {x2}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement