Home > Back-end >  Trouble BBS, help me see this topic!
Trouble BBS, help me see this topic!

Time:11-06

The Description

O a * x ^ 2 + b * x + c=0 equation root,

Input

Input several rows, each row three real said a, b, c, with 0 0 0 means input end,

Ouput

Output for each line, if no solution is "Unanswered," as if there is a solution from small to large, the output format for: "x1 x2==1.00 2.00," (the reserved 2 decimal places)

The Sample Input
1-2 1
1 1 1
1 0-1.21
0 0 0

The Sample Output
The x1 x2==1.00 1.00
Unanswered
X1=1.10 x2=1.10






#include
#include
Int main ()
{
Double x1, x2,
Double a, b, c, m, t;
Lf lf while (the scanf (" % % % lf ", & amp; A, & amp; B, & amp; C)!=(EOF)
{
M=b * * a * b - 4 c.
If (a==0 & amp; & B==0 & amp; & C==0)
{
return 0;
}
If (m<0)
{
X1=(a - b - SQRT (* a * b * b - 4 c))/2 * a;
X2=(a - b + SQRT (* a * b * b - 4 c))/2 * a;
Printf (" Unanswered \ n ");
The continue;
}
If (m==0)
{
X1=(a - b - SQRT (* a * b * b - 4 c))/2 * a;
X2=(a - b + SQRT (* a * b * b - 4 c))/2 * a;
Printf (" x1=%. Lf x2=% 2. 2 lf \ n ", x1, x2);
}
If (m> 0)
{
X1=(a - b - SQRT (* a * b * b - 4 c))/2 * a;
X2=(a - b + SQRT (* a * b * b - 4 c))/2 * a;
If (x1 & gt; X2)
{
T=x1;
The x1 x2=;
X2=t;
}
Printf (" x1=%. Lf x2=% 2. 2 lf \ n ", x1, x2);
}

}
return 0;
}



I am because of input - 2 5 0 just wrong,, every brother please help me to look at the point where wrong, thank you!
  • Related