Design an algorithm to find the real roots of a quadratic equation of the form ax2 + bx + c = 0, where a, b, and c are real numbers, and a is nonzero.
Include:
IPO Chart
Test Plan
Pseudocode Algorithm
Expert Answer
IPO Chart
Test Plan
Pseudocode Algorithm
- let d = b * b – 4 * a * c
- if d < 0 then
- print “No real roots.”
- else if d = 0 then
- print “Root is: “; -b / (2 * a); “.”
- else
- print “Roots are: “; (-b + sqrt ( d )) / (2 * a); ” and “; (-b – sqrt ( d )) / (2 * a); “.”
- end if