# 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;
}