answersLogoWhite

0

Where the equation is ax2 + bx + c the roots are given by the solutions to :

(-b +/- sqrt(b2 - 4ac))/2a

So you would first input the values of a, b , and c, then calculate [d = b*b - 4*a*c], and then determine whether it is positive or negative. If it is positive [d>0, or d=0], then you can continue:

so the two roots of x are: (-b + sqrt(d))/2/a, and (-b - sqrt(d))/2/a.

If d < 0, then you need to calculate sqrt(-d) and then display -b/2/a as the real part, and +/- sqrt(-d)/2/a as the imaginary parts.

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

BeauBeau
You're doing better than you think!
Chat with Beau
SteveSteve
Knowledge is a journey, you know? We'll get there.
Chat with Steve
JudyJudy
Simplicity is my specialty.
Chat with Judy

Add your answer:

Earn +20 pts
Q: A program to compute the real roots of the quadratic equation?
Write your answer...
Submit
Still have questions?
magnify glass
imp