20 lines
488 B
Python
Executable file
20 lines
488 B
Python
Executable file
import os
|
|
import math
|
|
|
|
print("Mettez vos valeurs a,b et c")
|
|
a = eval(input("a [x²] = "))
|
|
b = eval(input("b [x] = "))
|
|
c = eval(input("c = "))
|
|
delta = (b**2)-(4*a*c)
|
|
if delta == 0 :
|
|
x1 = -(b/2*a)
|
|
print ("x = "+str(x1))
|
|
elif delta < 0 :
|
|
print("Aucun racine.")
|
|
else :
|
|
x1 = (-b-math.sqrt(delta))/(2*a)
|
|
x2 = (-b+math.sqrt(delta))/(2*a)
|
|
print ("La première valeur est "+str(x1))
|
|
print ("Le deuxième valeur est "+str(x2))
|
|
|
|
os.system('pause')
|