新手求助,,为什么运行的是无限循环?
程序代码:
#include<stdio.h> #include<math.h> int main() { int k; double eps = pow(10, -6), s = 0, a, x; scanf_s("%lf", &x); a = x; int i = 1,q; while (fabs(a) >= eps) { k = 0; i++; s += a; for (q = i;q>3; q--) { printf("%d", q);//就是这里 if (q = i) a = pow(-1, q + 1) * (pow(x, 2 * q - 1) / (2 * q)); else a *= ((2 * q - 1) / (2 * q)); } } printf("%lf", s); return 0; }