求各位大侠看看这是怎么回事
# include <stdio.h># include <math.h>
main(void)
{
int a, b, c;
double delta, x1, x2;
printf("请输入a的值:");
scanf("%d\n", &a);
printf("你输入的值是:%d \n", a);
printf("请输入b的值:");
scanf("%d\n", &b);
printf("请输入c的值:");
scanf("%d\n", &c);
delta = (b*b) - (4*a*c);
if (delta >0)
{
x1 = (-b + sqrt(delta)) / (2*a);
x2 = (-b - sqrt(delta)) / (2*a);
printf("该一元二次方程有两个解, x1 = %f, x2 = %f \n", x1, x2);
}
else if (delta == 0)
{
x1 = (-b) / (2*a);
printf("该一元二次方程有一个唯一解,x1 = %f \n", x1 );
}
else
{
printf("无解\n");
}
return 0;
}