Find all Roots of a Quadratic Equation in Java1 min read

In this example you will learn How do you code a quadratic equation in Java.

The standard form of a quadratic equation is:

ax2 + bx + c = 0, where
a, b and c are real numbers and a
≠ 0

The term b2-4ac is known as the determinant of a quadratic equation. The determinant tells the nature of the roots.

  • If determinant is greater than 0, the roots are real and different.
  • If determinant is equal to 0, the roots are real and equal.
  • If determinant is less than 0, the roots are complex and different.


Java Code: Write a java program to find roots of a quadratic equation in all cases


Leave a Comment