作业帮 > 综合 > 作业

【在线等】【哪里有问题?】解一元二次方程的C程序

来源:学生作业帮 编辑:拍题作业网作业帮 分类:综合作业 时间:2024/05/23 11:54:42
【在线等】【哪里有问题?】解一元二次方程的C程序
#include
#include
main()
{
double a,b,c,d,x1,x2;
printf("Please input 3 number,use ',' to separate them\n");
scanf("%lf,l%f,%lf",&a,&b,&c);
d=b*b-4*a*c;
x1=(-b+sqrt(d))/2*a;
x2=(-b-sqrt(d))/2*a;
if (fabs(d)1e-6) printf("the Answer of ax^2+bx+c=0 is x1=%8.1lf,x2=%8.1lf\n",x1,x2);
else printf("the Answer of ax^2+bx+c=0 is none\n");
}
scanf("%lf,
(这里有问题应该是%lf)
,%lf",&a,&b,&c);