Advertisement
Sanlover

Untitled

May 17th, 2022
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. double partA(const double& x, const size_t& N)
  5. {
  6. double summary = x;
  7. double numerator = 1, denominator = 1;
  8. double xScale = x;
  9. int scale = 2;
  10. for (size_t i = 1; i < N; i++)
  11. {
  12. xScale *= -x;
  13. numerator *= (scale - 1);
  14. denominator *= scale;
  15. const double temp = numerator / denominator * xScale;
  16. summary += temp;
  17. scale += 2;
  18. }
  19. return summary;
  20. }
  21.  
  22. int main()
  23. {
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement