C语言高手帮忙啦 谢谢了

来源:百度知道 编辑:UC知道 时间:2024/06/05 13:19:28
这个怎么做啊 啊啊啊啊 :用二分法求方程2x3-4x2+3x-6=0在(a,b)之间的根。
例:输入 Please input the lower and upper boundaries: 3 10
输出 No root in this boundary!
Please input the lower and upper boundaries: 1 5
The root is 2.00

#include<stdio.h>
void main()
{
int m,n,count=0;
printf("input the m and n:\n");
scanf("%d%d",&m,&n);
if(m>n)
{
int temp=m;
m=n;
n=temp;
}
for(int i=m;i<=n;i++)
{
if(2*i*i*i-4*i*i+3*i-6==0)
{
printf("%d ",i);
count++;
}

}
if(count==0)
printf("No solution!\n");
}

找个同学问问,最方便省事