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