Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- { // problema 8
- long S,p,c;
- unsigned n,i;
- S=0;p=1;c=1;
- cout<<"n=";cin>>n;
- for (i=1;i<=n;i++)
- {
- p*=i;
- S+=c*p*p;
- c*=-1;
- }
- cout<<"S="<<S;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement