Be the first user to complete this post

  • 0
Add to List
Beginner

345. 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

Output:

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