Find Roots of Quadratic Equation Java Program

Java Program To Find Roots of a Quadratic Equation

Learn How To Find Roots of a Quadratic Equation in Java Programming Language. This Java Program To Compute Roots of Quadratic Equation makes use of If – Else Block.

What is a Quadratic Equation?

It is a term used in Elementary Algebra. The Standard Form of a Quadratic Equation is ax2 + bx + c = 0, where a, b, c are constant values which cannot be changed and x is a variable entity.

Quadratic Equation Formula

h = −b ± √(b2 − 4ac) / 2a

Conditions For Discriminants

  1. If b2 − 4ac = 0, One Real Solution is possible
  2. If b2 − 4ac is Positive, Two Real Solutions are possible
  3. If b2 − 4ac is Negative, Two Complex Solutions are possible

The java.lang.* package consists of Math.sqrt() method which helps to calculate the Square Root of the Discriminant.

Also Read: Java Program To Draw A Circle using Graphics

Java Program To Find Roots of a Quadratic Equation

Also Read: Java Code To Convert Numbers To Words


Find Roots of a Quadratic Equation in Java Programming Language

If you have any compilation errors or doubts in this Program to Find Roots of a Quadratic Equation in Java Programming Language, let us know about in the Comment Section below.

Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

Join The Discussion