#include<stdio.h>
#include<math.h>
float x1,x2,p,q,disc;
great_than_zero(float a,float b)
{
x1=(-b+sqrt(disc))/(2*a);
x2=(-b+sqrt(disc))/(2*a);
}
zero(float a,float b)
{
x1=x2=(-b)/(2*a);
}
small_than_zero(float a,float b)
{
p=(-b)/(2*a);
q=sqrt(disc)/(2*a);
}
main()
{
float a,b,c;
printf("please input equation\n");
scanf("%f,%f,%f",&a,&b,&c);
printf("the equation is %5.2fx*x+2*%5.2f*x+%5.2f=0",a,b,c);
disc=b*b-4*a*c;
if (disc>0)
{
great_than_zero(a,b);
printf("x1=%5.2f,x2=%5.2f",x1,x2);
}
else if (disc==0)
{
zero(a,b);
printf("x1=x2=%5.2f",x1);
}
else
{
small_than_zero(a,b);
printf("x1=%5.2f+%5.2f",p,q);
}
}