#include
#include"math.h"
void seekroot (float a,float b,float c) //求根函数
{
float m,term1,term2;
if(a==0)
if(b==0)
printf("the answer not exist.\n");
else printf("the answer is %f\n",-c/b);
else
{
m=b*b-4*a*c;
if(m>0)
{
term1=(-b+sqrt(m))/(2*a);
term2=(-b-sqrt(m))/(2*a);
printf("the root is %f and %f",term1,term2);}
else printf("the real root not exsit !\n");
}
}
main()
{
float d,e,f;
printf("please input three numbers;\n");
scanf("%f%f%f",&d,&e,&f);
seekroot(d,e,f);//调用求根函数
}
