Advertisement
Guest User

Untitled

a guest
Dec 15th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     float Z, x, A;
  9.     n = 1;
  10.     x = 0.2;
  11.     Z = 0;
  12.     A = ((pow((1+ x), (2* n))) / n) * pow(-1, n);
  13.     do
  14.     {
  15.         Z += A;
  16.         n++;
  17.         A = ((pow((1 + x), (2 * n))) / n) * pow(-1, n);
  18.     }
  19.     while (fabs(A) > 1 / 10000.);
  20.     printf("%f", Z);
  21.     return 0;
  22.  
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement