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