稍微改了下:
#include"stdio.h"
#include"math.h"
main()
{
float a,b,c,x1,x2,q,p;
printf("\n input three number:\n" );
scanf("%f%f%f",&a,&b,&c);
p=b*b-4*a*c;
if(p>0)
{
x1=(-b+sqrt(p))/2*a;
x2=(-b-sqrt(p))/2*a;
printf("%f%f\n",x1,x2);
}
else if(p==0){
q=-b/2*a;
printf("x1=x2=q:%f\n",q);
}
else
printf("此方程无实数根\n");
}