Skip to content

Commit 39e942b

Browse files
authored
Created File
1 parent 8840fbf commit 39e942b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Equation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import cmath
2+
a = float(input('Enter a: '))
3+
b = float(input('Enter b: '))
4+
c = float(input('Enter c: '))
5+
6+
# calculate the discriminant
7+
d = (b**2) - (4*a*c)
8+
9+
# find two solutions
10+
sol1 = (-b-cmath.sqrt(d))/(2*a)
11+
sol2 = (-b+cmath.sqrt(d))/(2*a)
12+
print('The solution are {0} and {1}'.format(sol1,sol2))

0 commit comments

Comments
 (0)