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:


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: