#include<stdio.h>
#include<math.h>
main()
{
double a,b,c,x1,x2;
printf("请输入a,b,c的值,并用空格隔开:\n");
scanf("%d %d %d",&a,&b,&c);
x1=(-b+sqrt(b*b-4*a*c))/2;
x2=(-b-sqrt(b*b-4*a*c))/2;
printf("方程%dx^2+%dx+%d=0的结果为:\n x1=%d\n x2=%d\n",a,b,c,x1,x2);
}
竟然提到这个求根的题目。希望楼主考虑到b*b-4*a*c小于零的时候!!!