Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- unsigned int x, k = 0, c;
- int y, z;
- cin >> x;
- z = 0; y = 0;
- while (x != 0)
- {
- c = x % 10;
- if (c == 9)
- {
- y = -1;
- break;
- }
- z = z * 10 + c + 1;
- k++;
- x = x / 10;
- }
- if (y != -1)
- while (z != 0)
- {
- y = y * 10 + z % 10;
- z = z / 10;
- }
- cout << y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement