Advertisement
H-a-y-K

Untitled

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