commit 57dbf87aa52f4dda01abeff5627947714bef38f0 parent a875fd1491937705e92a5345e381dc04316bf3bc Author: Martin J. Klöckner <martin.cachari@gmail.com> Date: Fri, 20 Nov 2020 00:09:54 -0300 Added cuadratic.py, a /c-repo/95.11/guia01/ej6.c cuadratic root calculator port from c to pyton Diffstat:
M | README.md | | | 4 | ++++ |
A | cuadratic.py | | | 11 | +++++++++++ |
2 files changed, 15 insertions(+), 0 deletions(-) diff --git a/README.md b/README.md @@ -1 +1,5 @@ # py-repo + +In this repository I'm gonna store all my .py files, the ideas of most of this +programs are taken from my c-repo and implemented briefly in python, to see +how different this langages are. diff --git a/cuadratic.py b/cuadratic.py @@ -0,0 +1,11 @@ +import math + +a = int(input("a: ")) +b = int(input("b: ")) +c = int(input("c: ")) + +x1 = (((-b) + math.sqrt((b*b)-(4*a*c))) / (2*a)) +x2 = (((-b) - math.sqrt((b*b)-(4*a*c))) / (2*a)) + +print("x1 = " + str(x1)) +print("x2 = " + str(x2))