Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main()
- {
- int num{ 0 };
- int delNum{ 0 };
- int pos{ 1 };
- std::cout << "Enter number: ";
- std::cin >> num;
- pos = num > 0 ? 1 : -1;
- num *= pos;
- for (int digit{ 0 }, mult{ 1 }; digit = num % 10, num; num /= 10)
- {
- if (digit != 3 and digit != 6)
- {
- delNum += digit * mult;
- mult *= 10;
- }
- }
- std::cout << "Corrected (maybe) number: " << delNum * pos << "\n";
- }
Add Comment
Please, Sign In to add comment