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

CoachCoach
Success isn't just about winning—it's about vision, patience, and playing the long game.
Chat with Coach
TaigaTaiga
Every great hero faces trials, and you—yes, YOU—are no exception!
Chat with Taiga
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin

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