#include#include int main() { double x, a, s; int n = 1; scanf("%lf", &x); a = x; s = a; while (fabs(a) >= 1e-5) { a = -a * x * x / ((n + 1) * (n + 2));//第n项 s = s + a; n += 2; } printf("%.4f", s); return 0; }
欢迎分享,转载请注明来源:内存溢出
#include#include int main() { double x, a, s; int n = 1; scanf("%lf", &x); a = x; s = a; while (fabs(a) >= 1e-5) { a = -a * x * x / ((n + 1) * (n + 2));//第n项 s = s + a; n += 2; } printf("%.4f", s); return 0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)