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