#include<stdio.h>
#include<math.h>
int main(void){
int a,b,c,x1,x2,s;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
if(b*b-4*a*c>=0){
s=sqrt(b*b-4*a*c);
x1=(-b+s)/2;
x2=(-b-s)/2;
if(x1==x2){
printf("Two same roots x=%d\n",x2);
}
else if(x1>x2){
printf("Two different roots x1=%d , x2=%d\n",x1,x2);
}
else {
printf("Two different roots x1=%d , x2=%d\n",x2,x1);
}
}
else {
printf("No real root\n");
}
}
return 0;
}
謝謝,我找到問題點了