Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 123.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include <math.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- int k, i, p, u;
- double s=0, w;
- cout << "k= ";
- cin >> k;
- for (i=1; i<=k; i++)
- { p=1;
- for (u=1; u<=i+1; u++)
- {
- p *= u;
- }
- cout << "fact" << i+1 << "= "<< p << endl;
- if (i != 2)
- {w = pow(-1., i)*p/(i*i-4);
- s+=w;}
- }
- cout << "w= " << s << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement