SorinTurda

B_Egal

Nov 22nd, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. int Egal(int n)
  2. {
  3.     int x = -1;
  4.     while(n)
  5.     {
  6.         int c = n % 10;
  7.         if(c % 2 == 1)
  8.         {
  9.             if(x == -1)
  10.                 x = c;
  11.             else
  12.                 if(x != c)
  13.                     return 0;
  14.         }
  15.         n /= 10;
  16.     }
  17.     return 1;
  18. }
Add Comment
Please, Sign In to add comment