Advertisement
Guest User

square_equaltion

a guest
Jan 18th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. #############INIT################
  2. x1 = float(input("Введите X1: "))
  3. x2 = float(input("Введите X2: "))
  4. a  = float(input("Введите  a: "))
  5. if x1 < x2:
  6.     temp = x1
  7.     x1 = x2
  8.     x2 = temp
  9. #################################
  10.  
  11. #####CALCULATIO#####
  12. e = x1 * 2 * a
  13. f = x2 * 2 * a
  14. k = ( e - f)/2
  15. b = e - k
  16. D = k ** 2
  17. c = ((b**2-D)/(4*a))
  18. ####################
  19.  
  20. ###########THE ANSWER###########
  21. print(str(a) + "x^2", end='')
  22. if not b == 0:
  23.     print("+" + str(b) + "x", end='')
  24. if not c == 0:
  25.     print("+" + str(c), end='')
  26. print("=0")
  27. ################################
  28.  
  29. input("\n \npress ENTER")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement