#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define e 2.71
double f(double num1) {
double num2;
num2=pow(num1,3)-2*sin(num1);
return num2;
} //definition of f(x)
int main() {
double x0, x1,xc,n1,n2,n3;
printf("x0값 입력:");
scanf("%lf", &x0);
printf("\n\n x1값 입력:");
scanf("%lf", &x1);
for (int i = 0; i < 6; i++) {
n1 = f(x1)*(x0 - x1);
printf("n1값:%lf\n", n1);
n2 = f(x0) - f(x1);
printf("n2값:%lf\n", n2);
n3 = n1 / n2;
xc = x1 - n3;
printf("\nXc의 값은: %lf\n", xc);
printf("f(Xc)의 값은: %lf\n",f(xc));
x0 = x1;
//printf("Xc의 값:%lf", xc);
x1 = xc;
}
}