解题思路:
会输入输出吧?输入a,b,c,输出两个结果(用float),中间带上公式,就完事了
注意事项:
给你公式
参考代码:
#include<stdio.h>
#include<math.h>
int main()
{
int a,b,c;
float z,x1,x2;
scanf("%d%d%d",&a,&b,&c);
z=(b*b)-(4*a*c); //根号下的数
x1=(-b+sqrt(z))/2*a; //用一个数学函数sqrt代表计算z的平方根
x2=(-b-sqrt(z))/2*a;
printf("%.2f %.2f\n",x1,x2);
return 0;
}
0.0分
2 人评分