Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4. #include <conio.h>
  5.  
  6. using namespace std;
  7.  
  8. //int factorial(int k);
  9. int main()
  10. {
  11. double a, b, h, x, r, s;
  12. int n, zn = -1, k;
  13. setlocale(LC_ALL, "Russian");
  14. cout << "Введите a,b,h,n" << endl;
  15. cin >> a >> b >> h >> n;
  16. for (x = a; x <= b; x += h);
  17. {
  18. r = s = 1;
  19. for (k = 1; k <= n; k++);
  20. {
  21. r = zn*r*(pow((2 * x),2.) / (2 * k));
  22. s += r;
  23. }
  24. cout << x << " " << s;
  25. }
  26. _getch();
  27. return 0;
  28. }
  29.  
  30. /* int factorial(int k)
  31. {
  32. if (k > 1)
  33. return k * factorial(k - 1);
  34. else
  35. return 1;
  36. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement