#include<stdio.h>
#include<math.h>
float e,f,g,h,i;
int main()
{
float yishigen(float x,float y);
float denggen(float x);
float xugen();
float a,b,c,p,q,k;
scanf("%f,%f,%f",&a,&b,&c);
p=-b/(2*a);
q=b*b-4*a*c;
k=sqrt(q)/(2*a);
if(q>0)
{
yishigen(p+k,p-k);
printf("x1=%f,x2=%f",p+k,p-k);
}
else if(q==0)
{
denggen(p);
printf("x1=x2=%f",p);
}
else
{
xugen();
printf("No!");
}
}
float yishigen(float x,float y)
{
h=-f/(2*e);
i=sqrt(e*e-4*e*f);
x=h+i;
y=h-i;
}
float denggen(float x)
{
h=-f/(2*e);
x=h;
}
float xugen()
{
printf("No!");
}经过运行是可以的,这道题有点难度,我也写了几次,希望对你有帮助
温馨提示:答案为网友推荐,仅供参考