Find the roots of Quadratic Equation – Java Program

Quadratic equation is in the form = ax2 + bx + c

Discriminant (d) = b2 – 4ac

Then roots are calculates using the equations below

Root_1 =  (-b + √d)/2a

Root_2 =  (-b – √d)/2a

See the image below

Quadratic Equation-1.png

Java Code:

Output:

Quadratic Equation: +3x^2 -5x -8 = 0, Roots are:(2.6666666666666665, -1.0

__________________________________________________
Top Companies Interview Questions..-

Google Microsoft Amazon Facebook more..

If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.
__________________________________________________

%d bloggers like this: