Pure Programmer
Blue Matrix


Cluster Map

Project: Quadratic Roots

Quadratic equations of the form Ax2 + Bx + C = 0 have two possible solutions given by the [[Quadratic Formula]]. Write a program that sets the constants A = 2, B = 4 and C = 1 then prints the two possible solutions. Then change the constants A, B and C to get solutions to other quadratic equations. Is it possible that this program could fail?

Output
$ python3 QuadraticRoots.py root #1: -0.2928932188134524 root #2: -1.7071067811865475

Solution