...

/

Example 10: Solve the Quadratic Equation

Example 10: Solve the Quadratic Equation

Learn how to solve quadratic equations using the IF conditions.

We'll cover the following...

Problem

A quadratic equation is an equation of this form:

ax2+bx+c=0ax^{2}+bx+c=0

Given the values of the coefficients a, b, and c, you need to find the corresponding quadratic equation solution.

The following output needs to be printed on the console:

  • Roots (if any)
  • No real roots (if no roots)

Example

Input (a, b, c) Output
1, 5, 6 -2.000000 , -3.000000
1, 2, 3 No real roots
...
Access this course and 1400+ top-rated courses and projects.