找c语言的错误

来源:百度知道 编辑:UC知道 时间:2024/06/10 07:01:40
#include <stdio.h>
main()
{
float a,b,c,t,n,m;

scanf("%f,%f,%f",&a,&b,&c);
m=b*b-4*a*c;

if (m<0)

printf("the fangcheng is not answer");

else if (m==0)
{
t=(-b)/2*a;

printf("%f",t);

}
else
{
t=(-b+sqrt(b*b-4*a*c))/2*a;
n=(-b-sqrt(b*b-4*a*c))/2*a;
printf("f",t);
printf("f",n);

}

}

#include <stdio.h>
#include <math.h>//要加头文件啊
int main()
{
float a,b,c,t,n,m;

scanf("%f%f%f",&a,&b,&c); //这里的格式控制串不对
m=b*b-4*a*c;

if (m<0)

printf("the fangcheng is not answer");

else if (m==0)
{
t=(-b)/2*a;

printf("%f",t);

}
else
{
t=(-b+sqrt(b*b-4*a*c))/2*a;
n=(-b-sqrt(b*b-4*a*c))/2*a;
printf("%f",t);
printf("%f",n);
}
}

“elseif”有问题!自己调式一下