Created
November 5, 2018 18:32
-
-
Save desinas/9ffa9dd5651531dc78b4c784eff6aba6 to your computer and use it in GitHub Desktop.
Coursity exerc2_1
This file contains 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
import math | |
print("α, β και γ παριστάνουν σταθερούς αριθμούς και α δεν είναι 0") | |
a =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή α: ")) | |
b =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή β: ")) | |
c =int(input("Για το τριώνυμο αx²+βx+γ δώστε τον συντελεστή γ: ")) | |
d=b**2-4*a*c | |
print("Η διακρίνουσα Δ=β²-4αγ είναι ", d) | |
if d>0 : | |
x_pl =(-b + math.sqrt(d)) /2*a | |
x_mi =(-b - math.sqrt(d)) /2*a | |
elif d<0 : | |
x_pl =(-b-math.sqrt(abs(d))) /2*a | |
x_mi =(-b+math.sqrt(abs(d))) /2*a | |
else : | |
x_pl =+(-b / 2*a) | |
x_mi =-(-b / 2*a) | |
print("Οι πραγματικές ρίζες του τριωνύμου είναι", x_pl, x_mi) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment