第九周慕课_练兵区_第一题

代码如下
#include<stdio.h>
#include<math.h>
int main()
{
float x1, x2, x0;
scanf("%f,%f", &x1, &x2);
x0 = (x1 + x2) / 2;
while (fabs(x0x0x0 - x0 - 1) > 1e-6)
{
if (x0x0x0 - x0 - 1 > 0)
x2 = x0;
else
x1 = x0;
x0 = (x1 + x2) / 2;
}
printf(“x=%6.2f\n”, x0);
}

猜你喜欢

转载自blog.csdn.net/weixin_43759910/article/details/85098262
今日推荐