解一元二次方程ax2+bx+c=0的解。题目保证有两个不同的解。
Input:
a,b,c的值。
Output:
两个根X1和X2,其中X1>=X2。。 结果保留两位小数。
Sample Input:
1 5 -2
Sample Output:
0.37 -5.37
****************************************************************************
#include<stdio.h>
#include<math.h>
int main()
{
double a,b,c;
scanf("%lf %lf %lf",&a,&b,&c);
double x1 =( (-b) + sqrt(b * b - 4 * a * c) ) / ( 2 * a );
double x2 =( (-b) - sqrt(b * b - 4 * a * c) ) / ( 2 * a );
printf("%.2lf %.2lf",x1,x2);
return 0;
}
***************************************************************************