求告诉我这个算一元二次方程的程序哪儿错了?怎么算都不对啊 #include#includeint main(void){\x05int a = 1;\x05int b = 5;\x05int c = 6;double delta ;double x1;double x2;delta = b*b - 4*a*c; if(delta > 0){\x05x1 = (-b + sqrt (delt
来源:学生作业帮助网 编辑:作业帮 时间:2024/09/08 14:27:45
![求告诉我这个算一元二次方程的程序哪儿错了?怎么算都不对啊 #include#includeint main(void){\x05int a = 1;\x05int b = 5;\x05int c = 6;double delta ;double x1;double x2;delta = b*b - 4*a*c; if(delta > 0){\x05x1 = (-b + sqrt (delt](/uploads/image/z/14824960-16-0.jpg?t=%E6%B1%82%E5%91%8A%E8%AF%89%E6%88%91%E8%BF%99%E4%B8%AA%E7%AE%97%E4%B8%80%E5%85%83%E4%BA%8C%E6%AC%A1%E6%96%B9%E7%A8%8B%E7%9A%84%E7%A8%8B%E5%BA%8F%E5%93%AA%E5%84%BF%E9%94%99%E4%BA%86%3F%E6%80%8E%E4%B9%88%E7%AE%97%E9%83%BD%E4%B8%8D%E5%AF%B9%E5%95%8A+%23include%23includeint+main%28void%29%7B%5Cx05int+a+%3D+1%3B%5Cx05int+b+%3D+5%3B%5Cx05int+c+%3D+6%3Bdouble+delta+%3Bdouble+x1%3Bdouble+x2%3Bdelta+%3D+b%2Ab+-+4%2Aa%2Ac%3B+if%28delta+%3E+0%29%7B%5Cx05x1+%3D+%28-b+%2B+sqrt+%28delt)
求告诉我这个算一元二次方程的程序哪儿错了?怎么算都不对啊 #include#includeint main(void){\x05int a = 1;\x05int b = 5;\x05int c = 6;double delta ;double x1;double x2;delta = b*b - 4*a*c; if(delta > 0){\x05x1 = (-b + sqrt (delt
求告诉我这个算一元二次方程的程序哪儿错了?
怎么算都不对啊
#include
#include
int main(void)
{
\x05int a = 1;
\x05int b = 5;
\x05int c = 6;
double delta ;
double x1;
double x2;
delta = b*b - 4*a*c;
if(delta > 0)
{
\x05x1 = (-b + sqrt (delta)) / (2*a);
\x05x2 = (-b - sqrt (delta)) / (2*a);
\x05printf("x1=%f,x2=%f\n");
}
else if (delta == 0)
{
\x05x2=x1;
\x05x1= (-b)/(2*a);
\x05\x05printf("x2=x1=%f;\n");
}
else
{
printf("无解;\n");
return 0 ;
}
return 0 ;
}
求告诉我这个算一元二次方程的程序哪儿错了?怎么算都不对啊 #include#includeint main(void){\x05int a = 1;\x05int b = 5;\x05int c = 6;double delta ;double x1;double x2;delta = b*b - 4*a*c; if(delta > 0){\x05x1 = (-b + sqrt (delt
//printf()用法错了 把前两个printf()改成下面这样就对了 望采纳
if(delta > 0)
{
x1 = (-b + sqrt (delta)) / (2*a);
x2 = (-b - sqrt (delta)) / (2*a);
printf("x1=%f,x2=%f\n",x1,x2);//
}
else if (delta == 0)
{
x1= (-b)/(2*a);
x2=x1;
printf("x2 = x1 =%f;\n",x1);
}
else
{
printf("无解;\n");
return 0 ;
}