Advertisement
sebyvs

Untitled

Jun 12th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void identice(int a, int b)
  6. {
  7.     int i, aux, x, nr;
  8.  
  9.     for(i = a; i <= b; i++)
  10.     {
  11.         nr = i;
  12.         aux = 0;
  13.  
  14.         x = nr % 10;
  15.         while(nr > 10 && aux == 0)
  16.         {
  17.             nr = nr / 10;
  18.             if(x != nr % 10)
  19.                 aux = 1;
  20.             x = nr % 10;
  21.         }
  22.         if(aux == 0)
  23.             cout << i << " ";
  24.     }
  25. }
  26.  
  27. int main()
  28. {
  29.     identice(700, 1500);
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement