Quadratic equations Real solutions in Java code

Write a Real solutions of Quadratic equations java code which will prints all real solutions of the user entered quadratic equation of form ax2+bx+c=0. Program should take the a,b,c  values and use the quadratic formula to calculate real solutions.

If the Calculated discriminant which is b2-4ac is negative, Program should display output with the generated message as  that there are no real solutions.

We can use sqrt functions for calculating Real solutions of Quadratic equations. Declare a.b,c and d as integer data types and e,f as double type.

Algorithm for Finding Real solutions of Quadratic equations in Java

  • Take input from user as values of a,b,c .
  • Print values to screen for user confirmation.
  • Calculate b2-4ac .
  • if b<0 no real Roots .
  • else Apply these formulas :


  • Print both the values to screen.

 Output of Real solutions of Quadratic equations Program