Home > Back-end >  Can help take a look at why will ask not to come out? . The value of the arccosx
Can help take a look at why will ask not to come out? . The value of the arccosx

Time:04-16

# include & lt; Stdio. H>
# include & lt; math.h>
# define PI 3.1415926
Int main () {
Double x, a, b, m, answer;
Lf the scanf (" % ", & amp; X);
M=0.000001;
A=0;
B=PI;
Answer=PI/2;
While (fabs (cos (answer) - x) & gt; M)
{
If (cos (answer) - x> M) {
B=answer;
}
The else {
A=answer;
}
Answer=(a + b)/2;
}
Printf (" % 5 lf ", answer);
return 0;
}

CodePudding user response:

Reference:
 # include & lt; Stdio. H> 
# include & lt; math.h>
# define PI 3.1415926
Int main () {
Double x, a, b, m, answer;
Lf the scanf (" % ", & amp; X);
M=0.000001;
A=0;
B=PI;
Answer=PI/2;
While (fabs (cos (answer) - x) & gt; M)
{
If (cos (answer) - x> M) {
A=answer;//b=answer;
}
The else {
B=answer;//a=answer;
}
Answer=(a + b)/2;
}
Printf (" % 5 lf ", answer);

return 0;
}
  • Related