Advertisement
Guest User

дискриминант

a guest
Dec 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. import math
  2. kek = - 1
  3. while kek < 0:
  4.     a = int(input('Введите a '))
  5.     b = int(input('Введите b '))
  6.     c = int(input('Введите c '))
  7.     result = b * b - 4 * a * c
  8.     print('Дискриминант =',result)
  9.     if result < 0:
  10.         print('Корней нет')
  11.     elif result > 0:
  12.         print('Сейчас мы выведем корни...')
  13.         r = math.sqrt(result)
  14.         print('Дискриминант под корнем =',r)
  15.         x1 = (-b - r) / (2 * a)
  16.         print('x1 =',x1)
  17.         x2 = (-b + r) / (2 * a)
  18.         print('x2 =',x2)
  19.     if result == 0:
  20.         print('Корень один, секундочку, подсчитаем...')
  21.         r = math.sqrt(result)
  22.         print('Дискриминант под корнем =',r)
  23.         x3 = -b / (2 * a)
  24.         print('x =',x3)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement