next up previous
Next: Python code Up: The Code Previous: The Code

Pseudocode

Here is pseudocode for solving a quadratic.

Read in a, b, c
Solve for two roots
Write the answers

This isn't detailed enough to explain all the steps clearly. It doesn't say which formula we will use for each root. So here it is with a bit more detail

Read in a, b, c
Get the sign of b
For the first root, use the standard formula with the sign in front
of the square root matching the sign of b.
For the second root, use the inverted formula with the sigh in
front of the square root matching the sign of b.
Write both answers.



Carleton DeTar 2017-09-05