請問:最後的檢測點答案為-1,而它顯示我的答案為-4,可以幫我看一下錯在哪裡嗎?
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int a,b,c,x1,x2,t,i;
while(scanf("%d%d%d",&a,&b,&c)!=EOF)
{
i=b*b-(4*a*c);
t=sqrt(i);
x1=(-1*b+t)/2*a;
x2=(-1*b-t)/2*a;
if(i<0)
{
printf("No real root\n");
}
else if(i==0)
{
printf("Two same roots x=%d\n",(-1*b)/2*a);
}
else
{
if(x1<x2)
{
printf("Two different roots x1=%d , x2=%d\n",x2,x1);
}
else
{
printf("Two different roots x1=%d , x2=%d\n",x1,x2);
}
}
}
return 0;
}