C Program to Find All Roots of Quadratic Equation

Write a C program to find roots of a quadratic equation.

A quadratic equation is a second order equation having a single variable. Any quadratic equation can be represented as ax2 + bx + c = 0, where a, b and c are constants( a can't be 0) and x is unknown variable.

For Example

To calculate the roots of quadratic equation we can use below formula. There are two solutions of a quadratic equation.x = (-2a + sqrt(D))/2
x = (-2a - sqrt(D))/2
where, D is Discriminant, which differentiate the nature of the roots of quadratic equation.