#include void main(void) { double x, a, b, s; int i, n; printf("n="); scanf("%d", &n); /*近似項数の入力*/ printf("x="); scanf("%lf", &x); /*xの入力*/ a = x - 1.0; b = 1.0; s = a / b; for (i = 2; i <= n; i++) { a = -a*(x-1.0); b = i; s = s + a / b; } printf("log(x)=%lf\n", s); /*結果の表示*/ }