Home > Back-end >  The root of the quadratic equation
The root of the quadratic equation

Time:11-16

#include
#include
Int main ()
{
Double a, b, c, x1, x2,
Double delta;
Lf the scanf (" % % % lf lf ", & amp; A, & amp; B, & amp; C);
If (a==0)
{
Printf (" is not a quadratic equation \ n ");
}
The delta=b * * a * b - 4 c.
If (delta=0)
{
X1=b/(2 * a);
Printf (" x1 x2==% 2 f \ n ", the x1);
}


Else if (delta<0)
{
Printf (" equations have no real root \ n ");
}
Else if (delta> 0)
{
Double t=SQRT (delta);
X1=(a - b + t)/(2 * a);
X2=(a - b - t)/(2 * a);
Printf (" x1=% 2 f, x2=%. 2 f \ n ", x1, x2);
}
return 0;
}

Why is wrong? Online help

CodePudding user response:

If (delta=0)
Into the if (delta==0)
  • Related