唉~~又遇见问题了,请教各位
解一元二次方程#include<stdio.h>
#include<stdlib.h>
#include<math.h>
main()
{
float a,b,c,d,x,x1,x2;
printf("please input three fioat number");
scanf("%.4lf%.4lf%.4lf",a,b,c);
d=b*b-4*a*c;
if(fabs(a)<1e-6){
printf("The equation is not quadratic");}
else if(fabs(d)<=1e-6){
x=-b/2/a;
printf("The equation has two equal roots:%.4f %.4f",x,x);}
else if(d>0){
x1=(-b+sqrt(d))/2/a;
x2=(-b-sqrt(d))/2/a;
printf("The equation has two distinct roots %.4f anf %.4f",x1,x2);}
else if(d<0){
x1=-b/2/a;
x2=-b/2/a;
x=sqrt(-d);
printf("The equation has two complex roots %.4f+%.4fi and %.4f+%.4fi",x1,x,x2,x);}
system("pause");
return 0;
}
刚学编程,找了好久不知道错误在哪?请各位帮帮忙,谢谢了