#include stdio.h
創(chuàng)新互聯(lián)是工信部頒發(fā)資質(zhì)IDC服務器商,為用戶提供優(yōu)質(zhì)的雅安服務器托管服務
#include math.h
double fun_math(double);
int main(void)
{
/*? 根據(jù)函數(shù)山喚可知Y是關于x的一個遞增函數(shù) */
/*? 先判斷輸漏唯消入Y時,X在(0,1)時是否有解 */
double Y;
double X=0 ,big_x=1.0,small_x=0,tmp_X=1;
unsigned int tmp=0;
printf("Please enter Y:");
scanf("%lf",Y);
if(fun_math(1) = Y 返知 fun_math(0) = Y)
{
while(tmp_X != X)
{
X =(big_x + small_x)/2;
if(fun_math(X)==Y) break;
if(fun_math(X)Y) big_x = X;
else small_x = X;
tmp_X = X ;
X =(big_x + small_x)/2;
}
printf("X = %.6lf",X);
}
else printf("while Y=%lf, X(0,1) on results\n",Y);
return 0;
}