Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int i=1;
- int j=0;
- bool cc=true;
- while(1)
- {
- if(cc)i++;
- if(!cc)i--;
- j++;
- if(i==n)
- cc=0;
- if(i==1)
- cc=1;
- if(j==n){cout<<i<<endl;
- return 0;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement