#17997: 不好意思,有人能幫我看看出了什麼問題嗎,好象是有格式方面的錯誤,感謝


jasonhsutsean@gmail.com (Jason Hsu)


#include <stdio.h>
#include<math.h>

int main() {
int a,b,c;
int temp;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
temp=b*b-4*a*c;
if(temp>0){
printf("Two different roots x1=%d,x2=%d\n",(-b+sqrt(temp))/(2*a),(-b-sqrt(temp))/(2*a));
}
elseif(temp==0){
printf("Two same roots x=%d\n",(-b/(2*a));
}
else{
printf("No real root\n");
}

}
}
return0;

}
#18055: Re:不好意思,有人能幫我看看出了什麼問題嗎,好象是有格式方面的錯誤,感謝


x0180368905 (香魚)


#include
#include

int main() {
int a,b,c;
int temp;
while(scanf("%d%d%d",&a,&b,&c)!=EOF){
temp=b*b-4*a*c;
if(temp>0){
printf("Two different roots x1=%d,x2=%d\n",(-b+sqrt(temp))/(2*a),(-b-sqrt(temp))/(2*a));
}
elseif(temp==0){
printf("Two same roots x=%d\n",(-b/(2*a));
}
else{
printf("No real root\n");
}

}
}
return0;

}

輸入要有空格啊