Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int num{ 124567 };
- int newNum{ 0};
- int mul{ 1 };
- bool operation{true};
- while (num)
- {
- int digit{ (num % 10) * mul };
- newNum += (operation ? digit * 10 : digit / 10);
- num /= 10;
- mul *= 10;
- operation = !operation;
- }
- std::cout << newNum << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement