Advertisement
H-a-y-K

Untitled

Nov 30th, 2020
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. int find(int num, int digit)
  4. {
  5.     while (num > 0)
  6.     {
  7.         if (num % 10 == digit)
  8.             return true;
  9.         num /= 10;
  10.     }
  11.  
  12.     return false;
  13. }
  14.  
  15. int repeating_digits(int num)
  16. {
  17.     while (num > 0)
  18.     {
  19.         if (find(num / 10, num % 10))
  20.             return true;
  21.         else
  22.             num /= 10;
  23.     }
  24.     return false;
  25. }
  26.  
  27. int main() {
  28.   std::cout << repeating_digits(221584);
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement