#include<stdio.h>
#include<math.h>
int main()
{
float a,b,c,d,f1,f2,y,p,m;
scanf("%f %f %f",&a,&b,&c);
d=b*b-4*a*c;
y=sqrt(d);
f1=(-b+y)/(2*a);
f2=(-b-y)/(2*a);
if(a==0)
{
printf("The equation is not quadratic.");
}
else if(a!=0)
{
if(d==0)
{
printf("The eaquation has two equal roots: %.4f.",f1);
}
else if(d>0)
{
y=sqrt(d);
printf("The eaquation has two distinct real roots: %.4f and %.4f.",f1,f2);
}
else if(d<0)
{
m=sqrt(-d)/(2*a);
p=-b/(2*a);
printf("The eaquation has two complex roots: %.4f+%.4fi and %.4f-%.4fi.",p,m,p,m);
}
}
return 0;
}
慕的地6079101
慕沐8454250
慕虎8333395
慕虎8333395
相关分类