解题思路:
注意事项:
参考代码:
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>
int main()
{
double a,b,c;
scanf("%lf%lf%lf",&a,&b,&c);
double x1=0.0,x2=0.0;
if(b*b-4*a*c<0)
{
printf("无解!");
}
else
{
x1=(-b+sqrt(b*b-4*a*c))/(2*a);
x2=(-b-sqrt(b*b-4*a*c))/(2*a);
}
printf("%.2f %.2f",x1,x2);
return 0;
}
0.0分
0 人评分