Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<windows.h>
- int main()
- {
- double a1 = 0.0,
- aPrev = 0.0,
- s = 0.0,
- n = 0.0,
- dif = 0.0,
- x = 0.0,
- c = 0.0,
- eps = 0.00000001;
- printf("x = ");
- scanf_s("%lf", &x);
- a1 = x;
- aPrev = a1;
- n++;
- s = a1;
- do
- {
- c = (-4.0*n*n*x*x-2*n*x*x);
- s = s + aPrev*c;
- dif = aPrev*c - aPrev;
- aPrev = aPrev*c;
- printf("%.8lf\n", fabs(dif));
- n++;
- break;
- } while (fabs(dif) > eps);
- printf("Sum = %.8lf", s);
- system("pause>0");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement