1 #include<stdio.h>
2 #include<math.h>
3 int main()
4 {
5 double a,b,c,disc,x1,x2,realpart,imagpart;
6 scanf("%lf,%lf,%lf",&a,&b,&c);
7 printf("the eauation ");
8 if(fabs(a)<=1e-6)
9 printf("is not a quadratic\n");
10 else
11 {
12 disc=b*b-4*a*c;
13 if(fabs(disc)<=1e-6)
14 printf("has tow eaual roots:%8.4f\n",-b/(2*a));
15 else
16 if(disc>=1e-6)
17 {
18 x1=(-b+sqrt(disc))/(2*a);
19 x2=(-b-sqrt(disc))/(2*a);
20 printf("has distinct real roots:%8.4f and %8.4F\n",x1,x2);
21 }
22 else
23 {
24 realpart=-b/(2*a);
25 imagpart=sqrt(disc)/(2*a);
26 printf("has complex roots:\n");
27 printf("%8.4f+%8.4f i\n",realpart,imagpart);
28 printf("%8.4f-%8.4f i\n",realpart,imagpart);
29 }
30 }return 0;
31 }