Advertisement
Guest User

Codigo do programa calculo raiz

a guest
Jun 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. ###importação###
  2.  
  3. import time
  4. import math
  5.  
  6. ###código###
  7. print('Iremos calcular as raízes da sua equação de segundo grau.')
  8. time.sleep(1)
  9. print('Por favor aguarde...')
  10. time.sleep(2)
  11.  
  12. a = int(input("digite o valor de a: "))
  13. b = int(input("digite o valor de b: "))
  14. c = int(input("digite o valor de c: "))
  15. delta = math.pow(b,2) - 4*a*c
  16. if delta < 0:
  17.     print("Não há raízes para essa equação.")
  18.     time.sleep(1)
  19.     print("Fechando o programa em alguns segundos..")
  20.     time.sleep(3)
  21. else:
  22.     raizdedelta = math.sqrt(delta)
  23.     print("Calculando delta...")
  24. time.sleep(2)
  25. print('Nosso delta é',raizdedelta)
  26. time.sleep(1)
  27. print('calculando as raízes..')
  28. raiz1 = (-b-raizdedelta)/(2*a)
  29. raiz2 = (-b+raizdedelta)/(2*a)
  30. time.sleep(2)
  31. print('Suas raízes são',raiz1,'e',raiz2)
  32. time.sleep(1)
  33. print('Fechando em 10 segundos.')
  34. time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement