Advertisement
Guest User

ConsoleApp10

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. // 123.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <math.h>
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int main()
  12. {
  13. int k, i, p, u;
  14. double s=0, w;
  15. cout << "k= ";
  16. cin >> k;
  17. for (i=1; i<=k; i++)
  18. { p=1;
  19. for (u=1; u<=i+1; u++)
  20. {
  21. p *= u;
  22. }
  23. cout << "fact" << i+1 << "= "<< p << endl;
  24. if (i != 2)
  25. {w = pow(-1., i)*p/(i*i-4);
  26. s+=w;}
  27.  
  28.  
  29.  
  30.  
  31. }
  32. cout << "w= " << s << endl;
  33. system("pause");
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement