| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,11 @@ | |||
| 1 | + import cmath | ||
| 2 | + | ||
| 3 | + print('Solve the quadratic equation: ax**2 + bx + c = 0') | ||
| 4 | + a = float(input('Please enter a : ')) | ||
| 5 | + b = float(input('Please enter b : ')) | ||
| 6 | + c = float(input('Please enter c : ')) | ||
| 7 | + delta = (b**2) - (4*a*c) | ||
| 8 | + solution1 = (-b-cmath.sqrt(delta))/(2*a) | ||
| 9 | + solution2 = (-b+cmath.sqrt(delta))/(2*a) | ||
| 10 | + | ||
| 11 | + print('The solutions are {0} and {1}'.format(solution1,solution2)) | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments