第三个else时为什么加了个冒号才正确,大师们看看呗
# include <stdio.h># include <math.h>
int main(void)
{
int a=1;
int b=2;
int c=3;
double x1;
double x2;
int deblt;
deblt=b*b-4*a*c;
if(deblt>0)
{
x1=-b+sqrt(deblt)/2*a;
x2=-b-sqrt(deblt)/2*a;
printf("方程的解为x1=%d,x2=%d\n",x1,x2);
}
else if(deblt==0)
{
x1=(-b)/2*a;
x2=x1;
printf("x1=x2=%d\n",x1,x2);
}
else (deblt<0);
{
printf("该方程无解\n");
}
return 0;
}