Advertisement
Guest User

Untitled

a guest
Feb 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. //#include <math.h>
  3.  
  4. double main_arctg(float x, float eps)
  5. {
  6. int n;
  7. n=1;
  8. double y=0.0;
  9. float c=x;
  10. while(fabs(c)>eps)
  11. {
  12. c=-c*x*x*x*x*(2*n-1)/(2*n+1);
  13. y=y+c;
  14. n++;
  15. }
  16. return x*y - 1;
  17. }
  18.  
  19. int main()
  20. {
  21. float x,eps,y;
  22. printf ("vvesti x,eps\n");
  23. scanf("%f%f",&x,&eps);
  24.  
  25. printf("--------------------\n");
  26. printf("| x | y | n |\n");
  27. printf("--------------------\n");
  28. y=main_arctg(x,eps);
  29. printf("\n| %7.4f | %7.4f | %7.4f\n",x,y,eps);
  30. printf("-----------------\n");
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement