Determine the roots of a Quadratic Equation A code that determines the roots of a quadratic equation.
Also, determine the following based on the discriminant b² – 4ac:

If b² − 4ac is positive, display: “There are TWO REAL SOLUTIONS.”
If b² − 4ac is zero, display: “There is ONLY ONE REAL SOLUTION.”
If b² − 4ac is negative, display: “There are TWO COMPLEX SOLUTIONS.”

#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

int main(){

    int a, b, c, d;
    double root1_real, root2_real, root1_complex, root1_i, root2_complex, root2_i, root_zero;

    printf(&quot;Enter a, b and c where a*x*x + b*x + c = 0\n&quot;);
    scanf(&quot;%d %d %d&quot;, &amp;a, &amp;b, &amp;c);

    d = b * b - 4 * a * c;
    
     if(d &gt; 0){ // Positive
        root1_real = (-b + sqrt(d)) / (2*a);
        root2_real = (-b - sqrt(d)) / (2*a);
        printf(&quot;First Root : %.2lf\n&quot;, root1_real);
        printf(&quot;Second Root : %.2lf\n&quot;, root2_real);
        printf(&quot;There are TWO REAL SOLUTIONS\n&quot;);
     }else if(d &lt; 0){ // Negative
        root1_complex = -b / (2 * a); root1_i = sqrt(-d) / (2 * a);
        root2_complex = -b / (2 * a); root2_i = sqrt(-d) / (2 * a);
        printf(&quot;First root : %.2lf + i%.2lf\n&quot;, root1_complex, root1_i);
        printf(&quot;Second root : %.2lf + i%.2lf\n&quot;, root2_complex, root2_i);
        printf(&quot;There are TWO COMPLEX SOLUTIONS\n&quot;);
     }else{ // Zero
        root_zero = (-b + sqrt(d)) / (2*a);
        printf(&quot;Root : %.2lf\n&quot;, root_zero);
        printf(&quot;There is ONLY ONE REAL SOLUTION\n&quot;);
     }
     
     return 0;
    
}
int main(void) is preferable, as that's clear about the number of arguments.
I don't understand why the coefficients must be integers - surely a quadratic equation can have any real coefficients?
We don't test whether the scanf() actually converted all three inputs.  If we are given something that's not an integer (perhaps a different kind of number, perhaps just garbage input), then the program will proceed with incorrect data, and produce output that might be plausible, instead of a sensible error message.  We need something more like:
double a, b, c;
if (scanf(&quot;%lf %lf %lf&quot;, &amp;a, &amp;b, &amp;c) != 3) {
   fputs(&quot;Invalid input\n&quot;, stderr);
   return 1;
}

There is another case of invalid input that's not checked - if a is zero, we don't want to divide by it.
You seem to have got confused which part is real and which imaginary here:
    root1_complex = -b / (2 * a); root1_i = sqrt(-d) / (2 * a);
    root2_complex = -b / (2 * a); root2_i = sqrt(-d) / (2 * a);

If we use better variable names, and reduce their scope a bit, we can make that simpler:
    double real = -b / (2 * a);
    double imag = sqrt(-d) / (2 * a);

And we can do all the printing in a single call to printf:
    printf(&quot;First root : %.2f + i%.2lf\n&quot;
           &quot;Second root : %.2lf + i%.2lf\n&quot;
           &quot;There are TWO COMPLEX SOLUTIONS\n&quot;,
           real, -imag,   real, imag);

When we know d is zero, there's really no point computing its square root:
 } else { // Zero
    root_zero = -b / (2*a);

As suggested in a comment, it might also be worth computing that common part of the three expressions to outside the if/else:
const double real =  -b / a / 2;
if (d &gt; 0) { // Positive
    double root = sqrt(d) / a / 2;
    ⋮
} else if (d &lt; 0) { // Negative
    double imag = sqrt(-d) / a / 2;
    ⋮
} else { // Zero
    ⋮
}


Here's a lightly modified version with my suggestions applied:
#include &lt;stdio.h&gt;
#include &lt;math.h&gt;

int main(void)
{
    printf(&quot;Enter a, b and c where ax² + bx + c = 0\n&quot;);
    double a, b, c;
    if (scanf(&quot;%lf%lf%lf&quot;, &amp;a, &amp;b, &amp;c) != 3) {
        fputs(&quot;Invalid input\n&quot;, stderr);
        return 1;
    }
    if (!a) {
        fputs(&quot;Quadratic term must not be zero\n&quot;, stderr);
        return 1;
    }

    const double d = b * b - 4 * a * c;

    printf(&quot;Finding the roots of %gx² + %gb + %g = 0\n&quot;, a, b, c);

    const double real =  -b / a / 2;
    if (d &gt; 0) {
        double root = sqrt(d) / a / 2;
        printf(&quot;First Root: %.4g\n&quot;
               &quot;Second Root: %.4g\n&quot;
               &quot;There are TWO REAL SOLUTIONS\n&quot;,
               real - root,   real + root);
    } else if (d &lt; 0) {
        double imag = sqrt(-d) / a / 2;
        printf(&quot;First root: %.4g + %.4gi\n&quot;
               &quot;Second root: %.4g + %.4gi\n&quot;
               &quot;There are TWO COMPLEX SOLUTIONS\n&quot;,
               real, -imag,   real, imag);
    } else { // d == 0
        printf(&quot;Root: %.4g\n&quot;
               &quot;There is ONLY ONE REAL SOLUTION\n&quot;,
               real);
    }
}