SHARE
TWEET

Untitled

a guest Nov 19th, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import math
  2.  
  3. def main():
  4.  
  5.     global a
  6.     global b
  7.     global c
  8.  
  9.     a = float(input("Intorduceti a: "))
  10.     b = float(input("Intorduceti b: "))
  11.     c = float(input("Intorduceti c "))
  12.  
  13.     return a,b,c
  14.  
  15. def ecuate_grad_doi(a,b,c):
  16.  
  17.     if a == 0:
  18.         print("Ecutia introdusa nu este de gradul doi")
  19.     else:
  20.           delta = b**2 - 4*a*c
  21.           if delta <0:
  22.              print("Ecautia nu are sulutii reale")
  23.           else:
  24.                 if delta == 0:
  25.                     solutie=(-b)/(2*a)
  26.                     print("Ecutia are solutie unice: x= ", solutie)
  27.                 else:
  28.                     sqrt_delta = math.sqrt(delta)
  29.                     solutie1 = (-b - sqrt_delta)/(2*a)
  30.                     sulutie2 =(-b+sqrt_delta)/(2*a)
  31.                     print("Ecutia are solutii: ")
  32.                     print("x1 = ", solutie1)
  33.                     print("x2 =", sulutie2)
  34.  
  35. main()
  36. ecuate_grad_doi(a,b,c)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top