帮忙看下,到底哪错了……
求一元二次方程的解# include <stdio.h>
# include <math.h>
int main (void)
{
double a,b,c;//三个系数
double x,x1,x2;//x1,x2是两个根
printf("%s","输入三个系数:");
scanf("%lf%lf%lf",&a,&b,&c);
x=(b*b-4.0*a*c);
x1=(-b+sqrt(x))/2.0*a;
x2=(-b-sqrt(x))/2.0*a;
if (x>0)
{
printf("x1=%f,x2=%f",x1,x2);
}
else if (x=0)
{
printf("x1=x2=%f",x1);
}
else
{
printf("无解");
}
return 0;
}