SHARE
TWEET

Untitled

a guest Nov 19th, 2019 90 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.     userInput = []
  10.  
  11.     a = float(input("Intorduceti a: "))
  12.     userInput.append(a)
  13.     b = float(input("Intorduceti b: "))
  14.     userInput.append(b)
  15.     c = float(input("Intorduceti c: "))
  16.     userInput.append(c)
  17.  
  18.  
  19.     if a > b and a > c:
  20.         print("\nValoarea maxima este: a")
  21.     elif b > a and b > c:
  22.         print("\nValoarea maxima este: b")
  23.     else:
  24.         print("\nValoarea maxima este: c")
  25.  
  26.     highestVal = max(userInput)
  27.     print("Valoarea maxima este:", max(a,b,c))
  28.  
  29. def ecuatie_de_gradul_doi(a,b,c):
  30.  
  31.     if a == 0:
  32.         print("\nEcutia introdusa nu este de gradul doi")
  33.     else:
  34.           delta = b**2 - 4*a*c
  35.           if delta <0:
  36.              print("\nEcautia nu are sulutii reale")
  37.           else:
  38.                 if delta == 0:
  39.                     solutie=(-b)/(2*a)
  40.                     print("\nEcutia are solutie unice: x= ", solutie)
  41.                 else:
  42.                     sqrt_delta = math.sqrt(delta)
  43.                     solutie1 = (-b - sqrt_delta)/(2*a)
  44.                     solutie2 =(-b+sqrt_delta)/(2*a)
  45.                     print("\nEcutia are solutii: ")
  46.                     print("\nx1 = ", solutie1)
  47.                     print("\nx2 =", solutie2)
  48.  
  49. main()
  50. ecuatie_de_gradul_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