Created
June 7, 2023 15:14
-
-
Save Armen-Jean-Andreasian/e07aeb2f36d4b41f82dc1bfd0ad5283a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# x**2 + 5x + 4 = 0 | |
a = 1 | |
b = 5 | |
c = 4 | |
D = b**2 - 4*a*c | |
if D > 0: | |
x_1 = ((-1 * b) + D**(1/2)) / 2 * a | |
x_2 = ((-1 * b) - D**(1/2)) / 2 * a | |
print(x_1, x_2) | |
elif D == 0: | |
x = (-1*b) / 2 * a | |
print(x) | |
elif D > 0: | |
print("No roots") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment