题目描述
用#include[HTML_REMOVED]中的sqrt进行开方
注意除以(2*a)要加括号
样例
#include <iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,c,d,x1,x2;
scanf("%lf %lf %lf",&a,&b,&c);
d=b*b-4*a*c;
if(d<0||a==0)printf("Impossivel calcular");
else
{
x1=(-b+sqrt(d))/(2*a);
x2=(-b-sqrt(d))/(2*a);
printf("R1 = %.5lf\nR2 = %.5lf\n",x1,x2);
}
return 0;
}