注意:
(1)double用/会有小数值
(2)细心,一个x1,一个x2
include[HTML_REMOVED]
include[HTML_REMOVED]
using namespace std;
int main()
{
double a,b,c,d,x1,x2;
scanf(“%lf%lf%lf”,&a,&b,&c);
d=bb-4ac;
if(d<0||a==0)
printf(“Impossivel calcular”);
else
{
d=sqrt(d);
x1=(-b+d)/(2a);
x2=(-b-d)/(2*a);
printf(“R1 = %.5lf\n”,x1);
printf(“R2 = %.5lf\n”,x2);
}
return 0;
}