-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexo1.py
More file actions
31 lines (28 loc) · 848 Bytes
/
exo1.py
File metadata and controls
31 lines (28 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*-coding:latin-1 -*
import os
a = 0
b = 0
c = 0
D = 0
a = input("saisissez votre nombre: ")
a = float( a )
b = input("saisissez votre nombre:")
b = float( b )
c = input("saisissez votre nombre:")
c = float( c )
D = ((b**2) - (4*a*c))
if((a == 0 and b == 0) and c == 0):
print("pas d'équation")
elif(a == 0 and (b != 0 and c!= 0)):
print("il s'agit d'une équation du 1er degrée et nn d'une éqution du 2nd , on va donc calculer la seule solution de : bx + c = 0 ")
print( (-c)/b )
else:
if(D < 0):
print("pas de solution réelle")
elif(D == 0):
print("on a une solution double x0")
print( (-b)/(2*a) )
else:
print("vous avez bien deux soulutions réelles et distinctes")
print( "les solutions sont : X1 =", ((-b) - sqrt(D))/(2*a), "\n X2=", ((-b) + sqrt(D))/(2*a) )
os.system("pause")