Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int find(int num, int digit)
- {
- while (num > 0)
- {
- if (num % 10 == digit)
- return true;
- num /= 10;
- }
- return false;
- }
- int repeating_digits(int num)
- {
- while (num > 0)
- {
- if (find(num / 10, num % 10))
- return true;
- else
- num /= 10;
- }
- return false;
- }
- int main() {
- std::cout << repeating_digits(221584);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement