#C語言
程式碼:
#include <stdio.h>
#include <math.h>
int main(void){
int a, b, c;
double juge;
scanf("%d%d%d", &a, &b, &c);
juge = b*b - 4*a*c;
if(juge>0){
printf("Two different roots x1=%d , x2=%d\n", (int)(-b+sqrt(juge))/(2*a), (int)(-b-sqrt(juge))/(2*a)); //double -> int 型別要轉換
}
else if(juge == 0){
printf("Two same roots x=%d\n", (-b)/(2*a));
}
else{
printf("No real root");
}
}