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};
- int digit{ 0 };
- int mult{ 1 };
- std::cout << "Enter number: ";
- std::cin >> num;
- num > 0 ? pos = 1 : pos = -1;
- num *= pos;
- while (num)
- {
- digit = num % 10;
- num /= 10;
- if (digit != 3 and digit != 6)
- {
- delNum += digit * mult;
- mult *= 10;
- }
- }
- std::cout << "Corrected (maybe) number: " << delNum * pos << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment