13,548,424 members
See more:
Write the algorithm using a flow chart and the algorithm description for calculating the root of a quadratic equation.

Posted 13-Sep-12 0:40am
Updated 13-Sep-12 0:55am
v2
AmitGajjar 13-Sep-12 6:45am

What you have done so far ?

Solution 3

What you have tried so far.? This seems like school or university assignment, assume that your teacher or lecturer is also reading these forums.

You should try something by your side first and then post question if you get stuck somewhere. You MUST try here[^] first.

Also refer How to ask a good question?[^]

Solution 4

Starting with:

ax2 + bx + c = 0

the two possible roots are given by

x1 = (-b + (b2 - 4ac)0.5) / 2a

x2 = (-b - (b2 - 4ac)0.5) / 2a

Depending on the domain in which the solution can lie, you might have to check the discriminant for being smaller than 0. The discriminant is the part inside the square root: b2 - 4ac.
If the domain of the solution are the real numbers R then the discriminant being less than zero will mean that there is no solution. Should the domain be in the set of complex numbers C a solution will exist even if the discriminant is less than zero:

x1 = -b/2a + J(|b2 - 4ac|)0.5/2a
x2 = -b/2a - J(|b2 - 4ac|)0.5/2a

Solutions of quadratic equations are always complex conjugates of each other when the discriminant is smaller than zero.

Should the discriminant be zero x1 = x2 = -b / 2a there is only one solution.

Now all that is left to do is input the coefficients a,b,c and do the calculations.
I don't think you'll find that too hard to do. Just give it a try!

Regards,

— Manfred
v4
__TR__ 13-Sep-12 7:34am

My 5 for the explanation and for adding "Thanks for your ideas!" to the OP's question :)

Solution 1

If you know how to solve it manually (you know that, right?) then you have the algorithm.

Solution 2

Top Experts
Last 24hrsThis month
 OriginalGriff 125 ppolymorphe 115 Afzaal Ahmad Zeeshan 60 Ralf Meier 35 PIEBALDconsult 35