望远
//运算符优先级的问题#include<stdio.h>
#include<math.h>
#define EPS 1e-1
int main()
{ float a, b, c, x1, x2;
printf("Input a,b,c:");
scanf("%f,%f,%f", &a, &b, &c);
if (b*b>4 * a*c) {
x1 = (-b+(float)sqrt(b*b - 4 * a*c))/2*a;
printf("x1=%5.2f\n", x1);
x2 = (-b-(float)sqrt(b*b - 4 * a*c))/2*a;
printf("x2=%5.2f\n", x2); }
else {
printf("此函数没有两个不相等的实数根\n");
}
}运行结果: